Skip to content

Commit b03d18a

Browse files
committed
fix: token == failure -> don't give it away
1 parent ab05183 commit b03d18a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

api/src/apihandler.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,23 +1056,21 @@ bool APIHandler::updateSmartCachesTransaction(csdb::Transaction trxn, cs::Sequen
10561056
}
10571057
}
10581058

1059-
cs::Hash newHash;
1059+
HashState res;
10601060
{ // signal to end waiting for a transaction
10611061
auto hashStateInst(lockedReference(this->hashStateSL));
10621062
(*hashStateInst)[target_pk].updateHash([&](const HashState& oldHash) {
1063-
HashState res;
1064-
1065-
auto newHashStr = trxn.user_field(cs::trx_uf::new_state::Hash).template value<std::string>();
1063+
auto newHashStr = trxn.user_field(cs::trx_uf::new_state::Hash).template value<std::string>();
10661064
if (!newHashStr.empty())
10671065
std::copy(newHashStr.begin(), newHashStr.end(), res.hash.begin());
1068-
res.retVal = trxn.user_field(cs::trx_uf::new_state::RetVal).template value<std::string>();
1069-
res.isOld = (newHash == oldHash.hash);
1066+
res.retVal = trxn.user_field(cs::trx_uf::new_state::RetVal).template value<std::string>();
1067+
res.isOld = (res.hash == oldHash.hash);
10701068
res.condFlg = true;
10711069
return res;
10721070
});
10731071
}
10741072

1075-
if (newHash != cs::Zero::hash) { // update tokens
1073+
if (res.hash != cs::Zero::hash) { // update tokens
10761074
auto caller_pk = s_blockchain.getAddressByType(execTrans.source(), BlockChain::AddressType::PublicKey);
10771075

10781076
if (is_smart_deploy(smart))

0 commit comments

Comments
 (0)