Skip to content

Commit

Permalink
Fix a balance check for block
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lemaire committed Apr 15, 2021
1 parent 1076564 commit a555941
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ class TransactionRepository(
wallet.sendCoins(sendRequest)
} else if ((block.transaction.get("direction") as String).equals("eurotoken")) {
Log.d("TradeEurotoken", "Sending eurotokens back to some address: ${block.transaction.get("receive") as String}")
sendTransferProposal((block.transaction.get("receive") as String).hexToBytes(), 100)
sendTransferProposal((block.transaction.get("receive") as String).hexToBytes(), 0)
}
} else {
Log.d("AgreementProp", "Received Agreement Block!" + "from : " + block.publicKey.toHex() + " our key : " + mykey.toHex())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fun getVerifiedBalanceForBlock(block: TrustChainBlock, database: TrustChainStore

fun getBalanceForBlock(block: TrustChainBlock, database: TrustChainStore): Long? {
if (TransactionRepository.EUROTOKEN_TYPES.contains(block.type)) {
if (block.isProposal)
if (block.isProposal && block.transaction[TransactionRepository.KEY_BALANCE] != null)
return (block.transaction[TransactionRepository.KEY_BALANCE] as Long)
if (block.isGenesis)
return getBalanceChangeForBlock(block)
Expand Down

0 comments on commit a555941

Please sign in to comment.