Skip to content

Commit

Permalink
Fix pool id serialization in update poolpair tx
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Fieroni <[email protected]>
  • Loading branch information
bvbfan committed Mar 29, 2021
1 parent 278f973 commit 96e675e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ class CCustomMetadataParseVisitor : public boost::static_visitor<Res>
}

CDataStream ss(metadata, SER_NETWORK, PROTOCOL_VERSION);
ss >> obj.poolId;
// serialize poolId as raw integer
ss >> obj.poolId.v;
ss >> obj.status;
ss >> obj.commission;
ss >> obj.ownerAddress;
Expand Down
5 changes: 3 additions & 2 deletions src/masternodes/rpc_poolpair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ UniValue updatepoolpair(const JSONRPCRequest& request) {

CDataStream metadata(DfTxMarker, SER_NETWORK, PROTOCOL_VERSION);
metadata << static_cast<unsigned char>(CustomTxType::UpdatePoolPair)
<< poolId << status << commission << ownerAddress;
// serialize poolId as raw integer
<< poolId.v << status << commission << ownerAddress;

if (targetHeight >= Params().GetConsensus().ClarkeQuayHeight) {
metadata << rewards;
Expand Down Expand Up @@ -741,7 +742,7 @@ UniValue updatepoolpair(const JSONRPCRequest& request) {
CCoinsViewCache coins(&::ChainstateActive().CoinsTip());
if (optAuthTx)
AddCoins(coins, *optAuthTx, targetHeight);
auto metadata = ToByteVector(CDataStream{SER_NETWORK, PROTOCOL_VERSION, poolId, status, commission, ownerAddress});
auto metadata = ToByteVector(CDataStream{SER_NETWORK, PROTOCOL_VERSION, poolId.v, status, commission, ownerAddress});
execTestTx(CTransaction(rawTx), targetHeight, metadata, CUpdatePoolPairMessage{}, coins);
}
return signsend(rawTx, pwallet, optAuthTx)->GetHash().GetHex();
Expand Down

0 comments on commit 96e675e

Please sign in to comment.