Skip to content

Commit

Permalink
Fixes test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashy5000 committed Mar 23, 2024
1 parent cd45653 commit 7ac018c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
26 changes: 15 additions & 11 deletions blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ var blockchain []Block

func GenesisBlock() Block {
return Block{
Sender: dsa.PublicKey{},
Recipient: dsa.PublicKey{},
Miner: dsa.PublicKey{},
Amount: 0,
Nonce: 0,
R: big.Int{},
S: big.Int{},
MiningTime: 0,
Difficulty: 0,
PreviousBlockHash: [32]byte{},
Timestamp: time.Time{},
Sender: dsa.PublicKey{},
Recipient: dsa.PublicKey{},
Miner: dsa.PublicKey{},
Amount: 0,
Nonce: 0,
SenderSignature: Signature{
R: big.Int{},
S: big.Int{},
},
MiningTime: 0,
Difficulty: 0,
PreviousBlockHash: [32]byte{},
Timestamp: time.Time{},
TimeVerifierSignatures: []Signature{},
TimeVerifiers: []dsa.PublicKey{},
}
}

Expand Down
1 change: 1 addition & 0 deletions create_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func CreateBlock(sender dsa.PublicKey, recipient dsa.PublicKey, amount float64,
if err != nil {
panic(err)
}
fmt.Println(string(bodyBytes))
// Unmarshal the response body
responseBlock := Block{}
err = json.Unmarshal(bodyBytes, &responseBlock)
Expand Down
3 changes: 1 addition & 2 deletions verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ func TestVerifyBlock(t *testing.T) {
Sender: sender,
Recipient: receiver,
Amount: 0,
R: *r,
S: *s,
SenderSignature: Signature{R: *r, S: *s},
PreviousBlockHash: HashBlock(GenesisBlock()),
Miner: key.PublicKey,
Difficulty: 1,
Expand Down

0 comments on commit 7ac018c

Please sign in to comment.