File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright (C) 2018-2024 The python-bitcoin-utils developers
2+ #
3+ # This file is part of python-bitcoin-utils
4+ #
5+ # It is subject to the license terms in the LICENSE file found in the top-level
6+ # directory of this distribution.
7+ #
8+ # No part of python-bitcoin-utils, including this file, may be copied,
9+ # modified, propagated, or distributed except according to the terms contained
10+ # in the LICENSE file.
11+
12+
13+ import unittest
14+
15+ from bitcoinutils .setup import setup
16+ from bitcoinutils .transactions import Transaction
17+
18+
19+ class TestFromRawUnsignedSegwit (unittest .TestCase ):
20+ def setUp (self ):
21+ setup ("mainnet" )
22+ self .raw_segwit_tx = [
23+ # Unsigned
24+ "02000000000102daf4d7b97a62dd9933bd6977b5da9a3edb7c2d853678c9932108f1eb4d27b7a90000000000fdffffffdaf4d7b97a62dd9933bd6977b5da9a3edb7c2d853678c9932108f1eb4d27b7a90100000000fdffffff0101410f0000000000160014e4d3a1ec51102902f6bbede1318047880c9c7680a7011900" ,
25+ # Signed
26+ "02000000000102daf4d7b97a62dd9933bd6977b5da9a3edb7c2d853678c9932108f1eb4d27b7a90000000000fdffffffdaf4d7b97a62dd9933bd6977b5da9a3edb7c2d853678c9932108f1eb4d27b7a90100000000fdffffff0101410f0000000000160014e4d3a1ec51102902f6bbede1318047880c9c7680024730440220495838c36533616d8cbd6474842459596f4f312dce5483fe650791c82e17221c02200660520a2584144915efa8519a72819091e5ed78c52689b24235182f17d96302012102ddf4af49ff0eae1d507cc50c86f903cd6aa0395f3239759c440ea67556a3b91b0247304402200090c2507517abc7a9cb32452aabc8d1c8a0aee75ce63618ccd901542415f2db02205bb1d22cb6e8173e91dc82780481ea55867b8e753c35424da664f1d2662ecb1301210254c54648226a45dd2ad79f736ebf7d5f0fc03b6f8f0e6d4a61df4e531aaca431a7011900"
27+ ]
28+
29+ def test_segwit_tx_from_raw (self ):
30+ for tx in self .raw_segwit_tx :
31+ tx_from_raw = Transaction .from_raw (tx )
32+ self .assertEqual (tx_from_raw .to_hex (), tx )
33+
34+
35+ if __name__ == "__main__" :
36+ unittest .main ()
You can’t perform that action at this time.
0 commit comments