@@ -35,6 +35,7 @@ use crate::ln::msgs::{MessageSendEvent, SerialId, TxSignatures};
35
35
use crate :: ln:: types:: ChannelId ;
36
36
use crate :: sign:: { EntropySource , P2TR_KEY_PATH_WITNESS_WEIGHT , P2WPKH_WITNESS_WEIGHT } ;
37
37
38
+ use alloc:: collections:: { btree_map, BTreeMap } ;
38
39
use core:: fmt:: Display ;
39
40
use core:: ops:: Deref ;
40
41
@@ -818,7 +819,7 @@ struct NegotiationContext {
818
819
holder_is_initiator : bool ,
819
820
received_tx_add_input_count : u16 ,
820
821
received_tx_add_output_count : u16 ,
821
- inputs : HashMap < SerialId , InteractiveTxInput > ,
822
+ inputs : BTreeMap < SerialId , InteractiveTxInput > ,
822
823
/// Optional intended/expected funding input, used during splicing.
823
824
/// The funding input is shared, it is usually co-owned by both peers.
824
825
/// - For the initiator:
@@ -836,7 +837,7 @@ struct NegotiationContext {
836
837
shared_funding_output : SharedOwnedOutput ,
837
838
prevtx_outpoints : HashSet < OutPoint > ,
838
839
/// The outputs added so far.
839
- outputs : HashMap < SerialId , InteractiveTxOutput > ,
840
+ outputs : BTreeMap < SerialId , InteractiveTxOutput > ,
840
841
/// The locktime of the funding transaction.
841
842
tx_locktime : AbsoluteLockTime ,
842
843
/// The fee rate used for the transaction
@@ -881,11 +882,11 @@ impl NegotiationContext {
881
882
holder_is_initiator,
882
883
received_tx_add_input_count : 0 ,
883
884
received_tx_add_output_count : 0 ,
884
- inputs : new_hash_map ( ) ,
885
+ inputs : BTreeMap :: new ( ) ,
885
886
shared_funding_input,
886
887
shared_funding_output,
887
888
prevtx_outpoints : new_hash_set ( ) ,
888
- outputs : new_hash_map ( ) ,
889
+ outputs : BTreeMap :: new ( ) ,
889
890
tx_locktime,
890
891
feerate_sat_per_kw,
891
892
}
@@ -1030,13 +1031,13 @@ impl NegotiationContext {
1030
1031
} ;
1031
1032
1032
1033
match self . inputs . entry ( msg. serial_id ) {
1033
- hash_map :: Entry :: Occupied ( _) => {
1034
+ btree_map :: Entry :: Occupied ( _) => {
1034
1035
// The receiving node:
1035
1036
// - MUST fail the negotiation if:
1036
1037
// - the `serial_id` is already included in the transaction
1037
1038
Err ( AbortReason :: DuplicateSerialId )
1038
1039
} ,
1039
- hash_map :: Entry :: Vacant ( entry) => {
1040
+ btree_map :: Entry :: Vacant ( entry) => {
1040
1041
if !self . prevtx_outpoints . insert ( prev_outpoint) {
1041
1042
// The receiving node:
1042
1043
// - MUST fail the negotiation if:
@@ -1140,13 +1141,13 @@ impl NegotiationContext {
1140
1141
let output =
1141
1142
InteractiveTxOutput { serial_id : msg. serial_id , added_by : AddingRole :: Remote , output } ;
1142
1143
match self . outputs . entry ( msg. serial_id ) {
1143
- hash_map :: Entry :: Occupied ( _) => {
1144
+ btree_map :: Entry :: Occupied ( _) => {
1144
1145
// The receiving node:
1145
1146
// - MUST fail the negotiation if:
1146
1147
// - the `serial_id` is already included in the transaction
1147
1148
Err ( AbortReason :: DuplicateSerialId )
1148
1149
} ,
1149
- hash_map :: Entry :: Vacant ( entry) => {
1150
+ btree_map :: Entry :: Vacant ( entry) => {
1150
1151
entry. insert ( output) ;
1151
1152
Ok ( ( ) )
1152
1153
} ,
0 commit comments