Skip to content

Commit 2b2f4c3

Browse files
committed
Don't bother clone'ing a Secp256k1 context into the offers flow
The new `OffersMessageFlow` stores yet another `Secp256k1` context internally, but to initialize requires passing one in explicitly. We call this in `ChannelManager` by `clone`ing the context we have before passing it in, allowing us to keep the randomization we do in `ChannelManager::new`. This isn't really worth the API annoyance of passing in a `Secp256k1` context, though, and luckily the contexts are eventually going to go away upstream eventually, so we just drop the argument from `OffersMessageFlow::new`, building an unrandomized `Secp256k1` context internally instead.
1 parent f239e2f commit 2b2f4c3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3962,7 +3962,7 @@ where
39623962
let flow = OffersMessageFlow::new(
39633963
ChainHash::using_genesis_block(params.network), params.best_block,
39643964
our_network_pubkey, current_timestamp, expanded_inbound_key,
3965-
node_signer.get_receive_auth_key(), secp_ctx.clone(), message_router, logger.clone(),
3965+
node_signer.get_receive_auth_key(), message_router, logger.clone(),
39663966
);
39673967

39683968
ChannelManager {
@@ -17997,7 +17997,6 @@ where
1799717997
highest_seen_timestamp,
1799817998
expanded_inbound_key,
1799917999
args.node_signer.get_receive_auth_key(),
18000-
secp_ctx.clone(),
1800118000
args.message_router,
1800218001
args.logger.clone(),
1800318002
)

lightning/src/offers/flow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ where
118118
pub fn new(
119119
chain_hash: ChainHash, best_block: BestBlock, our_network_pubkey: PublicKey,
120120
current_timestamp: u32, inbound_payment_key: inbound_payment::ExpandedKey,
121-
receive_auth_key: ReceiveAuthKey, secp_ctx: Secp256k1<secp256k1::All>, message_router: MR,
121+
receive_auth_key: ReceiveAuthKey, message_router: MR,
122122
logger: L,
123123
) -> Self {
124124
Self {
@@ -131,7 +131,7 @@ where
131131

132132
receive_auth_key,
133133

134-
secp_ctx,
134+
secp_ctx: Secp256k1::new(),
135135
message_router,
136136

137137
pending_offers_messages: Mutex::new(Vec::new()),

0 commit comments

Comments
 (0)