update ccid location in notarisation data
This commit is contained in:
@@ -131,8 +131,8 @@ public:
|
|||||||
uint256 txHash;
|
uint256 txHash;
|
||||||
char symbol[64] = "\0";
|
char symbol[64] = "\0";
|
||||||
uint256 MoM;
|
uint256 MoM;
|
||||||
uint32_t MoMDepth;
|
uint16_t MoMDepth;
|
||||||
uint32_t ccId;
|
uint16_t ccId;
|
||||||
uint256 MoMoM;
|
uint256 MoMoM;
|
||||||
uint32_t MoMoMDepth;
|
uint32_t MoMoMDepth;
|
||||||
|
|
||||||
@@ -154,8 +154,8 @@ public:
|
|||||||
if (s.size() == 0) return;
|
if (s.size() == 0) return;
|
||||||
READWRITE(MoM);
|
READWRITE(MoM);
|
||||||
READWRITE(MoMDepth);
|
READWRITE(MoMDepth);
|
||||||
if (s.size() == 0) return;
|
|
||||||
READWRITE(ccId);
|
READWRITE(ccId);
|
||||||
|
if (s.size() == 0) return;
|
||||||
if (IsBack) {
|
if (IsBack) {
|
||||||
READWRITE(MoMoM);
|
READWRITE(MoMoM);
|
||||||
READWRITE(MoMoMDepth);
|
READWRITE(MoMoMDepth);
|
||||||
|
|||||||
@@ -180,10 +180,6 @@ bool GetNextBacknotarisation(uint256 kmdNotarisationTxid, std::pair<uint256,Nota
|
|||||||
|
|
||||||
struct notarized_checkpoint* komodo_npptr(int32_t height);
|
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
|
* On assetchain
|
||||||
* in: txid
|
* in: txid
|
||||||
@@ -202,6 +198,9 @@ TxProof GetAssetchainProof(uint256 hash)
|
|||||||
if (!GetTransaction(hash, tx, blockHash, true))
|
if (!GetTransaction(hash, tx, blockHash, true))
|
||||||
throw std::runtime_error("cannot find transaction");
|
throw std::runtime_error("cannot find transaction");
|
||||||
|
|
||||||
|
if (blockHash.IsNull())
|
||||||
|
throw std::runtime_error("tx still in mempool");
|
||||||
|
|
||||||
blockIndex = mapBlockIndex[blockHash];
|
blockIndex = mapBlockIndex[blockHash];
|
||||||
if (!(np = komodo_npptr(blockIndex->nHeight)))
|
if (!(np = komodo_npptr(blockIndex->nHeight)))
|
||||||
throw std::runtime_error("notarisation not found");
|
throw std::runtime_error("notarisation not found");
|
||||||
@@ -222,9 +221,7 @@ TxProof GetAssetchainProof(uint256 hash)
|
|||||||
branch = GetMerkleBranch(nIndex, leaves.size(), tree);
|
branch = GetMerkleBranch(nIndex, leaves.size(), tree);
|
||||||
|
|
||||||
// Check branch
|
// Check branch
|
||||||
uint256 komodoGets = komodo_calcMoM(np->notarized_height, np->MoMdepth);
|
|
||||||
uint256 ourResult = SafeCheckMerkleBranch(blockIndex->hashMerkleRoot, branch, nIndex);
|
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)
|
if (np->MoM != ourResult)
|
||||||
throw std::runtime_error("Failed merkle block->MoM");
|
throw std::runtime_error("Failed merkle block->MoM");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
|||||||
{ "crosschainproof", 1},
|
{ "crosschainproof", 1},
|
||||||
{ "getproofroot", 2},
|
{ "getproofroot", 2},
|
||||||
{ "height_MoM", 1},
|
{ "height_MoM", 1},
|
||||||
{ "MoMoMdata", 3},
|
|
||||||
{ "calc_MoM", 2},
|
{ "calc_MoM", 2},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ UniValue MoMoMdata(const UniValue& params, bool fHelp)
|
|||||||
ret.push_back(Pair("MoMs", valMoms));
|
ret.push_back(Pair("MoMs", valMoms));
|
||||||
ret.push_back(Pair("notarization_hash", destNotarisationTxid.GetHex()));
|
ret.push_back(Pair("notarization_hash", destNotarisationTxid.GetHex()));
|
||||||
ret.push_back(Pair("MoMoM", MoMoM.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)));
|
ret.push_back(Pair("data", HexStr(vmomomdata)));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user