diff --git a/.gitignore b/.gitignore index 75ec3f0a..41d131c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.vscode/* \ No newline at end of file +.vscode/* +go.sum \ No newline at end of file diff --git a/Prioritize.go b/Prioritize.go index 334cd912..0500268a 100644 --- a/Prioritize.go +++ b/Prioritize.go @@ -47,7 +47,7 @@ func Prioritize() (uint64, []string, []string) { return comp(txInfo[i], txInfo[j]) }) var PermissibleTxs []TxInfo - var PermissibleWeight uint64 = 3999000 + var PermissibleWeight uint64 = 3999300 var reward uint64 = 0 for _, tx := range txInfo { if PermissibleWeight >= tx.Weight { @@ -59,5 +59,6 @@ func Prioritize() (uint64, []string, []string) { } } fmt.Println("weight: ", PermissibleWeight) + fmt.Println("reward: ", reward) return reward, permittedTxIDs, permittedWTxIDs } diff --git a/main.go b/main.go index 49abd5e8..21eb7454 100644 --- a/main.go +++ b/main.go @@ -43,8 +43,8 @@ func main() { if ProofOfWork(&Bh) { file, _ := os.Create("output.txt") defer file.Close() - fmt.Println(Bh.merkleRoot) - fmt.Println(Bh.nonce) + // fmt.Println(Bh.merkleRoot) + // fmt.Println(Bh.nonce) serializedBh := SerializeBlockHeader(&Bh) segserialized, _ := SegWitSerialize(cbTx) file.WriteString(hex.EncodeToString(serializedBh) + "\n") diff --git a/output.txt b/output.txt index 7a6e3c0a..296a7988 100644 --- a/output.txt +++ b/output.txt @@ -1,6 +1,6 @@ -0700000000000000000000000000000000000000000000000000000000000000000000003b0fcbaebce598b0ae1386125194000258b2bb5c5b42d9b71d9188a2eec82af815371c66ffff001ffb980100 -010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff028d4e8c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed790ff774f062f6a1cccb3e5b2fc2f220f44125d0aa32d9a26a189c6f8a7de5650120000000000000000000000000000000000000000000000000000000000000000000000000 -adc0f72f6d178bd42617e755d82703327082df7ba56d522c069e51b599441600 +0700000000000000000000000000000000000000000000000000000000000000000000008acb098b6fabb458fb5e9622c59b039f53be6b18ea74ba1ea979b9de7b867c18f4571c66ffff001fcd7c0000 +010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9edc12866091f7c0be0eabb04856dd16f94ccaf1d824fef2dbc601cf6af95304d9a0120000000000000000000000000000000000000000000000000000000000000000000000000 +af1ba229597bfda4230104246326f9441ce9a04f92354f9d786f5a759431a3ad 82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e 7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800 a9e537569db3c64340ed5abcdd983e9bb1b6ad6f90c93bc80d31c5cc0490bcea @@ -3352,4 +3352,4 @@ ec4b87ca63cec112765a1fe9236581ac5567c16be9e6c0cedcdb08283a8033ac dbb3b10ca1a6d0653bc1a9800de240020d6ac9d89fbebd77d6eb530401c8e5e8 f76c2690fe2a61749face27bf143e74a4d334fd201a91c579e96c6388354b544 faceb9ac544738ce1d3d7869e15ff79b4dc642bc9691ee785c0c629988a44d6a -f532292494c68cfcba35f14e271a072dd074c0d6fb65806ea129780f7abfe7f4 +4515dc4ad0d852d41d437a4706f700ee87c7654f505ec107e05daf832633cbb5 diff --git a/witnessMerkle.go b/witnessMerkle.go index ef77a73c..421682b4 100644 --- a/witnessMerkle.go +++ b/witnessMerkle.go @@ -8,14 +8,8 @@ func CreateWitnessMerkle() string { _, _, wTxIDs := Prioritize() wTxIDs = append([]string{"0000000000000000000000000000000000000000000000000000000000000000"}, wTxIDs...) merkleRoot := NewMerkleTree(wTxIDs) - // fmt.Println("Witness Merkle Root: ", hex.EncodeToString(merkleRoot.Data)) commitment_string := hex.EncodeToString(merkleRoot.Data) + "0000000000000000000000000000000000000000000000000000000000000000" WitnessCommitment, _ := hex.DecodeString(commitment_string) WitnessCommitment = to_sha(to_sha(WitnessCommitment)) - // file, _ := os.Create("wmkr.txt") - // defer file.Close() - // for _, tx := range wTxIDs { - // file.WriteString(tx + "\n") - // } return hex.EncodeToString(WitnessCommitment) }