1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
crateix!;
//-------------------------------------------[.cpp/bitcoin/src/policy/rbf.h]
/**
| Maximum number of transactions that
| can be replaced by BIP125 RBF (Rule #5).
| This includes all mempool conflicts
| and their descendants.
|
*/
pub const MAX_BIP125_REPLACEMENT_CANDIDATES: u32 = 100;
/**
| The rbf state of unconfirmed transactions
|
*/
//-------------------------------------------[.cpp/bitcoin/src/policy/rbf.cpp]
/**
| Enforce BIP125 Rule #3 "The replacement
| transaction pays an absolute fee of
| at least the sum paid by the original
| transactions." Enforce BIP125 Rule
| #4 "The replacement transaction must
| also pay for its own bandwidth at or above
| the rate set by the node's minimum relay
| fee setting."
|
| -----------
| @param[in] original_fees
|
| Total modified fees of original transaction(s).
| ----------
| @param[in] replacement_fees
|
| Total modified fees of replacement
| transaction(s).
| ----------
| @param[in] replacement_vsize
|
| Total virtual size of replacement transaction(s).
| ----------
| @param[in] relay_fee
|
| The node's minimum feerate for transaction
| relay.
| ----------
| @param[in] txid
|
| Transaction ID, included in the error
| message if violation occurs.
|
| -----------
| @return
|
| error string if fees are insufficient,
| otherwise std::nullopt.
|
*/
//-------------------------------------------[.cpp/bitcoin/src/util/rbf.h]
//-------------------------------------------[.cpp/bitcoin/src/util/rbf.cpp]
pub const MAX_BIP125_RBF_SEQUENCE: u32 = 0xfffffffd;
/**
| Check whether the sequence numbers
| on this transaction are signaling opt-in
| to replace-by-fee, according to BIP
| 125. Allow opt-out of transaction replacement
| by setting nSequence >
|
| MAX_BIP125_RBF_SEQUENCE (SEQUENCE_FINAL-2)
| on all inputs.
|
| SEQUENCE_FINAL-1 is picked to still
| allow use of nLockTime by non-replaceable
| transactions. All inputs rather than
| just one is for the sake of multi-party
| protocols, where we don't want a single
| party to be able to disable replacement
| by opting out in their own input.
|
*/