@@ -4208,7 +4208,9 @@ def test_simple_close_closer_pays_fee(node_factory, bitcoind):
42084208 # balance minus the fee. Either (l1-closer, l2-closee) or the reverse is fine.
42094209 txid = only_one (bitcoind .rpc .getrawmempool ())
42104210 tx = bitcoind .rpc .getrawtransaction (txid , True )
4211- out_sats = sorted (int (round (v ['value' ] * 10 ** 8 )) for v in tx ['vout' ])
4211+ # Elements adds an explicit fee vout (scriptPubKey.type == 'fee'); filter it out.
4212+ real_vouts = [v for v in tx ['vout' ] if v ['scriptPubKey' ].get ('type' ) != 'fee' ]
4213+ out_sats = sorted (int (round (v ['value' ] * 10 ** 8 )) for v in real_vouts )
42124214 assert len (out_sats ) == 2 , f"Expected 2 outputs in closing tx, got { out_sats } "
42134215
42144216 if l2_bal in out_sats :
@@ -4253,10 +4255,12 @@ def test_simple_close_dust_output_omitted(node_factory, bitcoind):
42534255 wait_for (lambda : bitcoind .rpc .getmempoolinfo ()['size' ] >= 1 )
42544256
42554257 # Every closing tx in the mempool must have exactly 1 output: the dust
4256- # output is omitted in all variants.
4258+ # output is omitted in all variants. Elements appends an explicit fee
4259+ # output (scriptPubKey type 'fee') which must not be counted here.
42574260 for txid in bitcoind .rpc .getrawmempool ():
42584261 tx = bitcoind .rpc .getrawtransaction (txid , True )
4259- assert len (tx ['vout' ]) == 1 , \
4262+ real_vouts = [v for v in tx ['vout' ] if v ['scriptPubKey' ].get ('type' ) != 'fee' ]
4263+ assert len (real_vouts ) == 1 , \
42604264 f"tx { txid } has { len (tx ['vout' ])} outputs; expected 1 (dust omitted)"
42614265
42624266
0 commit comments