Skip to content

Commit

Permalink
Merge pull request #11 from pred695/pred7
Browse files Browse the repository at this point in the history
fix: added more txs
  • Loading branch information
pred695 authored Apr 14, 2024
2 parents f939e63 + 27dbd01 commit 74624e7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode/*
.vscode/*
go.sum
3 changes: 2 additions & 1 deletion Prioritize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -59,5 +59,6 @@ func Prioritize() (uint64, []string, []string) {
}
}
fmt.Println("weight: ", PermissibleWeight)
fmt.Println("reward: ", reward)
return reward, permittedTxIDs, permittedWTxIDs
}
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
0700000000000000000000000000000000000000000000000000000000000000000000003b0fcbaebce598b0ae1386125194000258b2bb5c5b42d9b71d9188a2eec82af815371c66ffff001ffb980100
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff028d4e8c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed790ff774f062f6a1cccb3e5b2fc2f220f44125d0aa32d9a26a189c6f8a7de5650120000000000000000000000000000000000000000000000000000000000000000000000000
adc0f72f6d178bd42617e755d82703327082df7ba56d522c069e51b599441600
0700000000000000000000000000000000000000000000000000000000000000000000008acb098b6fabb458fb5e9622c59b039f53be6b18ea74ba1ea979b9de7b867c18f4571c66ffff001fcd7c0000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9edc12866091f7c0be0eabb04856dd16f94ccaf1d824fef2dbc601cf6af95304d9a0120000000000000000000000000000000000000000000000000000000000000000000000000
af1ba229597bfda4230104246326f9441ce9a04f92354f9d786f5a759431a3ad
82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e
7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800
a9e537569db3c64340ed5abcdd983e9bb1b6ad6f90c93bc80d31c5cc0490bcea
Expand Down Expand Up @@ -3352,4 +3352,4 @@ ec4b87ca63cec112765a1fe9236581ac5567c16be9e6c0cedcdb08283a8033ac
dbb3b10ca1a6d0653bc1a9800de240020d6ac9d89fbebd77d6eb530401c8e5e8
f76c2690fe2a61749face27bf143e74a4d334fd201a91c579e96c6388354b544
faceb9ac544738ce1d3d7869e15ff79b4dc642bc9691ee785c0c629988a44d6a
f532292494c68cfcba35f14e271a072dd074c0d6fb65806ea129780f7abfe7f4
4515dc4ad0d852d41d437a4706f700ee87c7654f505ec107e05daf832633cbb5
6 changes: 0 additions & 6 deletions witnessMerkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 74624e7

Please sign in to comment.