@@ -13,7 +13,7 @@ use bitcoin::blockdata::constants::genesis_block;
13
13
use bitcoin:: hash_types:: BlockHash ;
14
14
use bitcoin:: hashes:: { Hash , sha256} ;
15
15
use bitcoin:: network:: constants:: Network ;
16
- use bitcoin:: secp256k1:: { Message , PublicKey , Secp256k1 , self } ;
16
+ use bitcoin:: secp256k1:: PublicKey ;
17
17
use core:: num:: NonZeroU64 ;
18
18
use core:: ops:: { Bound , RangeBounds } ;
19
19
use core:: time:: Duration ;
@@ -50,7 +50,7 @@ impl OfferBuilder {
50
50
let offer = Offer {
51
51
id, chains : None , metadata : None , amount : None , description, features : None ,
52
52
absolute_expiry : None , issuer : None , paths, quantity_min : None , quantity_max : None ,
53
- node_id, send_invoice : None , signature : None ,
53
+ node_id, send_invoice : None ,
54
54
} ;
55
55
OfferBuilder { offer }
56
56
}
@@ -157,13 +157,6 @@ impl OfferBuilder {
157
157
self . offer . id = merkle:: root_hash ( & self . offer . to_bytes ( ) ) ;
158
158
self . offer
159
159
}
160
-
161
- ///
162
- pub fn build_signed < F > ( self , sign : F ) -> Result < Offer , secp256k1:: Error >
163
- where F : FnOnce ( & Message ) -> Signature
164
- {
165
- self . build ( ) . sign ( sign)
166
- }
167
160
}
168
161
169
162
///
@@ -263,29 +256,6 @@ impl Offer {
263
256
self . send_invoice . as_ref ( )
264
257
}
265
258
266
- fn sign < F > ( mut self , sign : F ) -> Result < Self , secp256k1:: Error >
267
- where F : FnOnce ( & Message ) -> Signature
268
- {
269
- let digest = self . to_message_digest ( ) ;
270
- let signature = sign ( & digest) ;
271
-
272
- let secp_ctx = Secp256k1 :: verification_only ( ) ;
273
- let pubkey = self . node_id ( ) ;
274
- secp_ctx. verify_schnorr ( & signature, & digest, & pubkey. into ( ) ) ?;
275
-
276
- self . signature = Some ( signature) ;
277
- Ok ( self )
278
- }
279
-
280
- fn to_message_digest ( & self ) -> Message {
281
- Self :: message_digest ( self . id )
282
- }
283
-
284
- fn message_digest ( offer_id : sha256:: Hash ) -> Message {
285
- let tag = sha256:: Hash :: hash ( concat ! ( "lightning" , "offer" , "signature" ) . as_bytes ( ) ) ;
286
- Message :: from_slice ( & merkle:: tagged_hash ( tag, offer_id) ) . unwrap ( )
287
- }
288
-
289
259
fn to_bytes ( & self ) -> Vec < u8 > {
290
260
use util:: ser:: Writeable ;
291
261
let mut buffer = Vec :: new ( ) ;
@@ -316,7 +286,6 @@ impl Offer {
316
286
quantity_max : self . quantity_max . map ( Into :: into) ,
317
287
node_id : self . node_id . as_ref ( ) ,
318
288
send_invoice : self . send_invoice . as_ref ( ) . map ( |_| & ( ) ) ,
319
- signature : self . signature . as_ref ( ) ,
320
289
}
321
290
}
322
291
}
@@ -360,7 +329,6 @@ tlv_stream!(struct OfferTlvStream {
360
329
( 22 , quantity_max: u64 ) ,
361
330
( 24 , node_id: PublicKey ) ,
362
331
( 26 , send_invoice: Empty ) ,
363
- ( 240 , signature: Signature ) ,
364
332
} ) ;
365
333
366
334
#[ derive( Clone , Debug , PartialEq ) ]
@@ -387,7 +355,7 @@ mod tests {
387
355
388
356
use bitcoin:: blockdata:: constants:: genesis_block;
389
357
use bitcoin:: network:: constants:: Network ;
390
- use bitcoin:: secp256k1:: { KeyPair , PublicKey , Secp256k1 , SecretKey } ;
358
+ use bitcoin:: secp256k1:: { PublicKey , Secp256k1 , SecretKey } ;
391
359
use core:: num:: NonZeroU64 ;
392
360
use core:: time:: Duration ;
393
361
use ln:: features:: OfferFeatures ;
@@ -429,7 +397,6 @@ mod tests {
429
397
assert_eq ! ( offer. quantity_max( ) , 1 ) ;
430
398
assert_eq ! ( offer. node_id( ) , pubkey( ) ) ;
431
399
assert_eq ! ( offer. send_invoice( ) , None ) ;
432
- assert_eq ! ( offer. signature( ) , None ) ;
433
400
434
401
assert_eq ! ( tlv_stream. chains, None ) ;
435
402
assert_eq ! ( tlv_stream. metadata, None ) ;
@@ -444,26 +411,6 @@ mod tests {
444
411
assert_eq ! ( tlv_stream. quantity_max, None ) ;
445
412
assert_eq ! ( tlv_stream. node_id, Some ( & pubkey( ) ) ) ;
446
413
assert_eq ! ( tlv_stream. send_invoice, None ) ;
447
- assert_eq ! ( tlv_stream. signature, None ) ;
448
- }
449
-
450
- #[ test]
451
- fn builds_signed_offer ( ) {
452
- let secp_ctx = Secp256k1 :: new ( ) ;
453
- let keys = KeyPair :: from_secret_key ( & secp_ctx, & privkey ( ) ) ;
454
- let pubkey = PublicKey :: from ( keys) ;
455
-
456
- let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey) )
457
- . build_signed ( |digest| secp_ctx. sign_schnorr_no_aux_rand ( digest, & keys) )
458
- . unwrap ( ) ;
459
- assert ! ( offer. signature( ) . is_some( ) ) ;
460
-
461
- let wrong_keys = KeyPair :: from_secret_key ( & secp_ctx, & blinded_privkey ( 99 ) ) ;
462
- assert ! (
463
- OfferBuilder :: new( "foo" . into( ) , Destination :: NodeId ( pubkey) )
464
- . build_signed( |digest| secp_ctx. sign_schnorr_no_aux_rand( digest, & wrong_keys) )
465
- . is_err( )
466
- ) ;
467
414
}
468
415
469
416
#[ test]
0 commit comments