Skip to content

Commit 8823f1a

Browse files
authored
Merge pull request #1305 from mkoura/fix_script_withdrawals
Script withdrawals are no longer listed among normal withdrawals
2 parents d636850 + 1c00421 commit 8823f1a

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

cardano_node_tests/utils/dbsync_utils.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,17 @@ def check_tx(
767767
tx_mint_by_token == db_mint_txouts
768768
), f"MA minting outputs don't match ({tx_mint_by_token} != {db_mint_txouts})"
769769

770-
len_db_withdrawals = len(response.withdrawals)
771-
len_out_withdrawals = len(tx_raw_output.withdrawals)
770+
tx_withdrawals = sorted(
771+
[*tx_raw_output.withdrawals, *[s.txout for s in tx_raw_output.script_withdrawals]]
772+
)
773+
db_withdrawals = sorted(response.withdrawals)
774+
len_tx_withdrawals = len(tx_withdrawals)
775+
len_db_withdrawals = len(db_mint_txouts)
776+
772777
assert (
773-
len_db_withdrawals == len_out_withdrawals
774-
), f"Number of TX withdrawals doesn't match ({len_db_withdrawals} != {len_out_withdrawals})"
778+
len_db_withdrawals == len_tx_withdrawals
779+
), f"Number of TX withdrawals doesn't match ({len_db_withdrawals} != {len_tx_withdrawals})"
775780

776-
tx_withdrawals = sorted(tx_raw_output.withdrawals)
777-
db_withdrawals = sorted(response.withdrawals)
778781
assert (
779782
tx_withdrawals == db_withdrawals
780783
), f"TX withdrawals don't match ({tx_withdrawals} != {db_withdrawals})"

cardano_node_tests/utils/tx_view.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,12 @@ def check_tx_view( # noqa: C901
250250
withdrawal_amount = int(withdrawal["amount"].split()[0] or 0)
251251
loaded_withdrawals.add((withdrawal_key, withdrawal_amount))
252252

253+
tx_raw_withdrawals_encoded = [
254+
*tx_raw_output.withdrawals,
255+
*[s.txout for s in tx_raw_output.script_withdrawals],
256+
]
253257
tx_raw_withdrawals = {
254-
(helpers.decode_bech32(r.address)[2:], r.amount) for r in tx_raw_output.withdrawals
258+
(helpers.decode_bech32(r.address)[2:], r.amount) for r in tx_raw_withdrawals_encoded
255259
}
256260

257261
if tx_raw_withdrawals != loaded_withdrawals:

0 commit comments

Comments
 (0)