From dc345fc3b9ec4ffb248f9469037282cc1c3fa5fd Mon Sep 17 00:00:00 2001 From: Nithish Karthik Date: Thu, 11 Apr 2024 01:59:43 +0530 Subject: [PATCH] fix: Duplicate memory allocation --- src/mining/mining.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mining/mining.go b/src/mining/mining.go index 0e78854..b49581c 100644 --- a/src/mining/mining.go +++ b/src/mining/mining.go @@ -58,8 +58,8 @@ func MineBlock(candidateBlock Block, outputFilePath string) error { func findNonce(candidateBlock *Block) uint32 { // serialized block will be of 80 byte - w := bytes.NewBuffer(make([]byte, 0, 80)) for { + w := bytes.NewBuffer(make([]byte, 0, 84)) header := candidateBlock.BlockHeader nBits := candidateBlock.BlockHeader.Bits nonce := GetRandomNonce()