File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111import hashlib
1212
1313
14- tx_details = ""
15- with open (
16- "./examples/mempool/test_tx.json" ,
17- "r" ,
18- ) as file :
19- tx_details = json .load (file )
20-
21- setup ("mainnet" )
22-
23-
24- from_addr = "0000000000000000000000000000000000000000000000000000000000000000"
25- to_addr = "bc1pvh7n6s375348q5zjfrde38nnq2lmhhtyaeqe8hv6t8mf398smeyqnug47s"
26- to_addr = P2trAddress (to_addr )
27-
28-
2914def calculate_wtxid (tx_hex ):
3015 tx_binary = bytes .fromhex (tx_hex )
3116 hash_once = hashlib .sha256 (tx_binary ).digest ()
@@ -198,6 +183,19 @@ def mine_block(block_header_bytes, target_hex):
198183
199184
200185def main ():
186+
187+ with open (
188+ "./examples/mempool/test_tx.json" ,
189+ "r" ,
190+ ) as file :
191+ tx_details = json .load (file )
192+
193+ setup ("mainnet" )
194+
195+ from_txid = "0000000000000000000000000000000000000000000000000000000000000000"
196+ to_addr = "bc1pvh7n6s375348q5zjfrde38nnq2lmhhtyaeqe8hv6t8mf398smeyqnug47s"
197+ to_addr = P2trAddress (to_addr )
198+
201199 # create a coinbase transaction
202200 witness_reserved_value = (
203201 "0000000000000000000000000000000000000000000000000000000000000000"
@@ -209,7 +207,7 @@ def main():
209207 tx1 = Transaction ()
210208 tx1 = tx1 .from_raw (tx_details ["hex" ])
211209 txinp = TxInput (
212- txid = from_addr ,
210+ txid = from_txid ,
213211 txout_index = 0 ,
214212 script_sig = Script ([witness_reserved_value ]),
215213 )
You can’t perform that action at this time.
0 commit comments