diff --git a/cli_getbalance.go b/cli_getbalance.go index c67c536..814569d 100644 --- a/cli_getbalance.go +++ b/cli_getbalance.go @@ -10,12 +10,13 @@ func (cli *CLI) getBalance(address string) { log.Panic("ERROR: Address is not valid") } bc := NewBlockchain() + UTXOSet := UTXOSet{bc} defer bc.db.Close() balance := 0 pubKeyHash := Base58Decode([]byte(address)) pubKeyHash = pubKeyHash[1 : len(pubKeyHash)-4] - UTXOs := bc.FindUTXO(pubKeyHash) + UTXOs := UTXOSet.FindUTXO(pubKeyHash) for _, out := range UTXOs { balance += out.Value