Skip to content

Commit

Permalink
Merge pull request #9 from pred695/pred5
Browse files Browse the repository at this point in the history
fix: segserialized cbtx
  • Loading branch information
pred695 authored Apr 14, 2024
2 parents e8b9a0c + 50637dc commit 2b77f8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func main() {

cbTx := Coinbase(netReward)
serializedcbTx, _ := serializeTransaction(cbTx)
fmt.Printf("CBTX: %x\n", serializedcbTx)
TxIDs = append([]string{hex.EncodeToString(reverseBytes(to_sha(to_sha(serializedcbTx))))}, TxIDs...)
mkr := NewMerkleTree(TxIDs)
Bh.merkleRoot = hex.EncodeToString(mkr.Data)
Expand All @@ -42,8 +43,9 @@ func main() {
fmt.Println(Bh.merkleRoot)
fmt.Println(Bh.nonce)
serializedBh := SerializeBlockHeader(&Bh)
segserialized, _ := SegWitSerialize(cbTx)
file.WriteString(hex.EncodeToString(serializedBh) + "\n")
file.WriteString(hex.EncodeToString(serializedcbTx) + "\n")
file.WriteString(hex.EncodeToString(segserialized) + "\n")
for _, tx := range TxIDs {
file.WriteString(tx + "\n")
}
Expand Down
4 changes: 2 additions & 2 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
0700000000000000000000000000000000000000000000000000000000000000000000001469c49fc3a805b159391bfc2921584aa21f67e9f545d1110bff17d3313b83f5f3321c66ffff001f602f0500
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02895d8c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed392466efe913d353921707d69a39cfb22952a7d75de836728f73705b3c5db5e400000000
0700000000000000000000000000000000000000000000000000000000000000000000001469c49fc3a805b159391bfc2921584aa21f67e9f545d1110bff17d3313b83f5ee341c66ffff001f0ba90000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02895d8c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed392466efe913d353921707d69a39cfb22952a7d75de836728f73705b3c5db5e40120000000000000000000000000000000000000000000000000000000000000000000000000
76bdb34d637ae63ec4ee9dc11c8e242c1ce89cef399dedbfc902e325c44e9e86
82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e
7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800
Expand Down

0 comments on commit 2b77f8b

Please sign in to comment.