Skip to content

Commit 49549ab

Browse files
committed
Merge branch 'master' into elem-23.2.3-rc2
2 parents d75c232 + 99ca072 commit 49549ab

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

src/node/miner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct update_for_parent_inclusion
129129
{
130130
e.nModFeesWithAncestors -= iter->GetFee();
131131
e.nSizeWithAncestors -= iter->GetTxSize();
132+
e.discountSizeWithAncestors -= iter->GetDiscountTxSize();
132133
e.nSigOpCostWithAncestors -= iter->GetSigOpCost();
133134
}
134135

test/functional/feature_discount_ct.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def set_test_params(self):
1919
"-con_connect_genesis_outputs=1",
2020
"-initialfreecoins=2100000000000000",
2121
"-txindex=1",
22+
"-blindedaddresses=1",
2223
"-minrelaytxfee=0.00000100",
2324
"-blockmintxfee=0.00000100",
2425
"-fallbackfee=0.00000100",
@@ -184,6 +185,62 @@ def run_test(self):
184185
tx = node0.getrawtransaction(txid, True)
185186
assert_equal(tx['vsize'], 2575)
186187

188+
# check transaction package
189+
self.log.info("Create discounted package")
190+
addr = node1.getnewaddress()
191+
addr2 = node1.getnewaddress()
192+
utxo = node1.listunspent()[0]
193+
fee = Decimal('0.00000035')
194+
inputs = [{"txid": utxo["txid"], "vout": utxo["vout"]}]
195+
change = Decimal('0.00001000')
196+
amount = utxo["amount"] - change - fee
197+
outputs = [
198+
{addr: amount},
199+
{addr2: change},
200+
{"fee": fee}
201+
]
202+
raw = node1.createrawtransaction(inputs, outputs)
203+
blind = node1.blindrawtransaction(raw, False)
204+
signed = node1.signrawtransactionwithwallet(blind)
205+
assert_equal(signed["complete"], True)
206+
test = node1.testmempoolaccept([signed['hex']])
207+
assert_equal(test[0]["allowed"], True)
208+
txid = node1.sendrawtransaction(signed['hex'])
209+
tx = node1.gettransaction(txid, True, True)
210+
assert_equal(tx['decoded']['discountvsize'], 341)
211+
212+
for i in range(24):
213+
self.log.info(f"Add package descendant {i+1}")
214+
addr = node1.getnewaddress()
215+
addr2 = node1.getnewaddress()
216+
fee = Decimal('0.00000035')
217+
change = Decimal('0.00001000')
218+
inputs = [{"txid": txid, "vout": 0}]
219+
amount -= change + fee
220+
outputs = [
221+
{addr: amount},
222+
{addr2: change},
223+
{"fee": fee}
224+
]
225+
raw = node1.createrawtransaction(inputs, outputs)
226+
blind = node1.blindrawtransaction(raw, False)
227+
signed = node1.signrawtransactionwithwallet(blind)
228+
assert_equal(signed["complete"], True)
229+
hex = signed["hex"]
230+
test = node1.testmempoolaccept([hex])
231+
assert_equal(test[0]["allowed"], True)
232+
txid = node1.sendrawtransaction(hex)
233+
tx = node1.gettransaction(txid, True, True)
234+
assert_equal(tx['decoded']['discountvsize'], 341)
235+
assert_equal(len(node1.getrawmempool()), i + 2)
236+
237+
assert_equal(len(node1.getrawmempool()), 25)
238+
self.log.info("Mine the package")
239+
self.generate(node1, 1, sync_fun=self.sync_blocks)
240+
assert_equal(len(node1.getrawmempool()), 0)
241+
tx = node1.gettransaction(txid, True, True)
242+
assert_equal(tx["confirmations"], 1)
243+
self.log.info("Success")
187244

188245
if __name__ == '__main__':
189246
CTTest().main()

0 commit comments

Comments
 (0)