Browse Source

update ccid location in notarisation data

metaverse
Scott Sadler 6 years ago
parent
commit
91d929221c
  1. 6
      src/cc/eval.h
  2. 9
      src/crosschain.cpp
  3. 1
      src/rpcclient.cpp
  4. 2
      src/rpccrosschain.cpp

6
src/cc/eval.h

@ -131,8 +131,8 @@ public:
uint256 txHash;
char symbol[64] = "\0";
uint256 MoM;
uint32_t MoMDepth;
uint32_t ccId;
uint16_t MoMDepth;
uint16_t ccId;
uint256 MoMoM;
uint32_t MoMoMDepth;
@ -154,8 +154,8 @@ public:
if (s.size() == 0) return;
READWRITE(MoM);
READWRITE(MoMDepth);
if (s.size() == 0) return;
READWRITE(ccId);
if (s.size() == 0) return;
if (IsBack) {
READWRITE(MoMoM);
READWRITE(MoMoMDepth);

9
src/crosschain.cpp

@ -180,10 +180,6 @@ bool GetNextBacknotarisation(uint256 kmdNotarisationTxid, std::pair<uint256,Nota
struct notarized_checkpoint* komodo_npptr(int32_t height);
int32_t komodo_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth);
/*
* On assetchain
* in: txid
@ -202,6 +198,9 @@ TxProof GetAssetchainProof(uint256 hash)
if (!GetTransaction(hash, tx, blockHash, true))
throw std::runtime_error("cannot find transaction");
if (blockHash.IsNull())
throw std::runtime_error("tx still in mempool");
blockIndex = mapBlockIndex[blockHash];
if (!(np = komodo_npptr(blockIndex->nHeight)))
throw std::runtime_error("notarisation not found");
@ -222,9 +221,7 @@ TxProof GetAssetchainProof(uint256 hash)
branch = GetMerkleBranch(nIndex, leaves.size(), tree);
// Check branch
uint256 komodoGets = komodo_calcMoM(np->notarized_height, np->MoMdepth);
uint256 ourResult = SafeCheckMerkleBranch(blockIndex->hashMerkleRoot, branch, nIndex);
printf("Komodo gets:%s, we get:%s\n", komodoGets.GetHex().data(), ourResult.GetHex().data());
if (np->MoM != ourResult)
throw std::runtime_error("Failed merkle block->MoM");
}

1
src/rpcclient.cpp

@ -147,7 +147,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "crosschainproof", 1},
{ "getproofroot", 2},
{ "height_MoM", 1},
{ "MoMoMdata", 3},
{ "calc_MoM", 2},
};

2
src/rpccrosschain.cpp

@ -115,7 +115,7 @@ UniValue MoMoMdata(const UniValue& params, bool fHelp)
ret.push_back(Pair("MoMs", valMoms));
ret.push_back(Pair("notarization_hash", destNotarisationTxid.GetHex()));
ret.push_back(Pair("MoMoM", MoMoM.GetHex()));
auto vmomomdata = E_MARSHAL(ss << ccid; ss << MoMoM; ss << ((uint32_t)0));
auto vmomomdata = E_MARSHAL(ss << MoMoM; ss << ((uint32_t)0));
ret.push_back(Pair("data", HexStr(vmomomdata)));
return ret;
}

Loading…
Cancel
Save