diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..5a3288f --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..1f7c45d --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/.idea/webServers.xml b/.idea/webServers.xml new file mode 100644 index 0000000..cafab32 --- /dev/null +++ b/.idea/webServers.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/pybtc/blockchain.py b/pybtc/blockchain.py index 3d59474..f4704e1 100644 --- a/pybtc/blockchain.py +++ b/pybtc/blockchain.py @@ -912,3 +912,15 @@ class BlockTemplate(): block += t["data"] return double_sha256(header,1), block + def build_orphan(self, hash, ntime): + self.previous_block_hash = hexlify(reverse_hash(s2rh(hash))).decode() + self.time = hexlify(ntime.to_bytes(4, "big")).decode() + self.height += 1 + self.transactions = list() + self.txid_list = list() + self.scan_tx_list() + self.coinbase_tx = self.create_coinbase_transaction() + self.coinb1, self.coinb2 = self.split_coinbase() + self.target = bits2target(self.bits) + self.difficulty = target2difficulty(self.target) + self.merkle_branches = [hexlify(i).decode() for i in merkle_branches([self.coinbase_tx.hash, ] + self.txid_list)] \ No newline at end of file