From a157a5c6a1933cf6e2bf3e5998a226317aaad118 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 14 Feb 2022 14:10:08 -0500 Subject: [PATCH] update --- src/Makefile.test-hush.include | 4 ++-- src/cc/CC_made_easy.md | 4 ++-- src/cc/betprotocol.cpp | 4 ++-- src/cc/betprotocol.h | 4 ++-- src/cc/channels.cpp | 8 +++---- src/cc/eval.cpp | 12 +++++------ src/cc/eval.h | 4 ++-- src/cc/gateways.cpp | 18 ++++++++-------- src/cc/importgateway.cpp | 14 ++++++------ src/cc/importpayout.cpp | 4 ++-- src/hush.h | 14 ++++++------ src/hush_bitcoind.h | 26 +++++++++++------------ src/main.cpp | 2 +- src/notarizationdb.h | 6 +++--- src/test-hush/test_eval_bet.cpp | 6 +++--- src/test-hush/test_parse_notarization.cpp | 2 +- 16 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/Makefile.test-hush.include b/src/Makefile.test-hush.include index f638ebe59..9d6379ea0 100644 --- a/src/Makefile.test-hush.include +++ b/src/Makefile.test-hush.include @@ -12,8 +12,8 @@ hush_test_SOURCES = test-hush/main.cpp # test-hush/test_cryptoconditions.cpp \ # test-hush/test_coinimport.cpp \ # test-hush/test_eval_bet.cpp \ -# test-hush/test_eval_notarisation.cpp \ -# test-hush/test_parse_notarisation.cpp \ +# test-hush/test_eval_notarization.cpp \ +# test-hush/test_parse_notarization.cpp \ # test-hush/test_addrman.cpp \ # test-hush/test_netbase_tests.cpp diff --git a/src/cc/CC_made_easy.md b/src/cc/CC_made_easy.md index 149c5321c..79655dcbc 100644 --- a/src/cc/CC_made_easy.md +++ b/src/cc/CC_made_easy.md @@ -496,13 +496,13 @@ channelsopen: Used to open channel between two pub keys (sender and receiver). Parameters: destination_pubkey, total_number_of_payments, payment_denomination. Example - channelsopen 03a8fe537de2ace0d9c210b0ff945085c9192c9abf56ea22f22ce7998f289bb7bb 10 10000000 channelspayment: - Sending payment to receiver. Condition is that the channel open tx is confirmed/notarised. Parameters: open_tx_id, payment_amount, [secret] (optional, used when receiver needs to make a payment which secret has already been revealed by sender). + Sending payment to receiver. Condition is that the channel open tx is confirmed/notarized. Parameters: open_tx_id, payment_amount, [secret] (optional, used when receiver needs to make a payment which secret has already been revealed by sender). Example - channelspayment b9c141facc8cb71306d0de8e525b3de1450e93e17fc8799c8fda5ed52fd14440 20000000 channelsclose: Marking channel as closed. This RPC only creates a tx which says that the channel is closed and will be used in refund RPC to withdraw funds from closed channel. This also notifies receiver that channel fund could be withdrawn, but the payment RPC is still available until all funds are withdrawn. Parameters: open_tx_id. Example - channelsclose b9c141facc8cb71306d0de8e525b3de1450e93e17fc8799c8fda5ed52fd14440 channelsrefund: - Withdrawing funds back to senders address. Refund can be issued only when channel close tx is confirmed/notarised. Parameters: open_tx_id, close_tx_id + Withdrawing funds back to senders address. Refund can be issued only when channel close tx is confirmed/notarized. Parameters: open_tx_id, close_tx_id Example - channelsrefund b9c141facc8cb71306d0de8e525b3de1450e93e17fc8799c8fda5ed52fd14440 bb0ea34f846247642684c7c541c435b06ee79e47893640e5d2e51023841677fd channelsinfo: Getting info about channels in which the issuer is involved, either as sender or receiver. Call without parameters give the list of available channels. Parameters: [open_tx_id] (optional - used to get info about specific channel) diff --git a/src/cc/betprotocol.cpp b/src/cc/betprotocol.cpp index d8e904287..c6b76bb2c 100644 --- a/src/cc/betprotocol.cpp +++ b/src/cc/betprotocol.cpp @@ -164,7 +164,7 @@ bool GetOpReturnHash(CScript script, uint256 &hash) /* * Crypto-Condition EVAL method that verifies a payout against a transaction - * notarised on another chain. + * notarized on another chain. * * IN: params - condition params * IN: importTx - Payout transaction on value chain (HUSH) @@ -219,7 +219,7 @@ bool Eval::ImportPayout(const std::vector params, const CTransaction &i // Check disputeTx solves momproof from vout[0] { NotarizationData data(0); - if (!GetNotarizationData(proof.notarisationHash, data)) + if (!GetNotarizationData(proof.notarizationHash, data)) return Invalid("coudnt-load-mom"); if (data.MoM != proof.branch.Exec(disputeTx.GetHash())) diff --git a/src/cc/betprotocol.h b/src/cc/betprotocol.h index 6694cb331..5dd920aba 100644 --- a/src/cc/betprotocol.h +++ b/src/cc/betprotocol.h @@ -29,12 +29,12 @@ class MoMProof { public: MerkleBranch branch; - uint256 notarisationHash; + uint256 notarizationHash; ADD_SERIALIZE_METHODS; template inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(branch); - READWRITE(notarisationHash); + READWRITE(notarizationHash); } }; diff --git a/src/cc/channels.cpp b/src/cc/channels.cpp index 135d0dc9d..389de64d8 100644 --- a/src/cc/channels.cpp +++ b/src/cc/channels.cpp @@ -250,7 +250,7 @@ bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & else if ( ConstrainVout(channelOpenTx.vout[2],1,destmarker,CC_MARKER_VALUE)==0 ) return eval->Invalid("vout.2 is CC marker to destpub or invalid amount for channelopen!"); else if (hush_txnotarizedconfirmed(opentxid) == 0) - return eval->Invalid("channelopen is not yet confirmed(notarised)!"); + return eval->Invalid("channelopen is not yet confirmed(notarized)!"); else if ( IsCCInput(tx.vin[0].scriptSig) != 0 ) return eval->Invalid("vin.0 is normal for channelpayment!"); else if ( IsCCInput(tx.vin[tx.vin.size()-2].scriptSig) == 0 ) @@ -311,7 +311,7 @@ bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & else if ( ConstrainVout(channelOpenTx.vout[2],1,destmarker,CC_MARKER_VALUE)==0 ) return eval->Invalid("vout.2 is CC marker to destpub or invalid amount for channelopen!"); else if (hush_txnotarizedconfirmed(opentxid) == 0) - return eval->Invalid("channelopen is not yet confirmed(notarised)!"); + return eval->Invalid("channelopen is not yet confirmed(notarized)!"); else if ( IsCCInput(tx.vin[0].scriptSig) != 0 ) return eval->Invalid("vin.0 is normal for channelclose!"); else if ( IsCCInput(tx.vin[tx.vin.size()-2].scriptSig) == 0 ) @@ -352,9 +352,9 @@ bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & else if ( ConstrainVout(channelOpenTx.vout[2],1,destmarker,CC_MARKER_VALUE)==0 ) return eval->Invalid("vout.2 is CC marker to destpub or invalid amount for channelopen!"); else if (hush_txnotarizedconfirmed(opentxid) == 0) - return eval->Invalid("channelopen is not yet confirmed(notarised)!"); + return eval->Invalid("channelopen is not yet confirmed(notarized)!"); else if (hush_txnotarizedconfirmed(param3) == 0) - return eval->Invalid("channelClose is not yet confirmed(notarised)!"); + return eval->Invalid("channelClose is not yet confirmed(notarized)!"); else if ( IsCCInput(tx.vin[0].scriptSig) != 0 ) return eval->Invalid("vin.0 is normal for channelrefund!"); else if ( IsCCInput(tx.vin[tx.vin.size()-2].scriptSig) == 0 ) diff --git a/src/cc/eval.cpp b/src/cc/eval.cpp index 9f362db6c..c99160a3b 100644 --- a/src/cc/eval.cpp +++ b/src/cc/eval.cpp @@ -180,14 +180,14 @@ bool Eval::CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t t return CheckTxAuthority(tx, auth); } -// Get MoM from a notarisation tx hash (on HUSH) +// Get MoM from a notarization tx hash (on HUSH) bool Eval::GetNotarizationData(const uint256 notaryHash, NotarizationData &data) const { - CTransaction notarisationTx; + CTransaction notarizationTx; CBlockIndex block; - if (!GetTxConfirmed(notaryHash, notarisationTx, block)) return false; - if (!CheckNotaryInputs(notarisationTx, block.GetHeight(), block.nTime)) return false; - if (!ParseNotarizationOpReturn(notarisationTx, data)) return false; + if (!GetTxConfirmed(notaryHash, notarizationTx, block)) return false; + if (!CheckNotaryInputs(notarizationTx, block.GetHeight(), block.nTime)) return false; + if (!ParseNotarizationOpReturn(notarizationTx, data)) return false; return true; } @@ -205,7 +205,7 @@ std::string Eval::GetAssetchainsSymbol() const /* - * Notarization data, ie, OP_RETURN payload in notarisation transactions + * Notarization data, ie, OP_RETURN payload in notarization transactions */ bool ParseNotarizationOpReturn(const CTransaction &tx, NotarizationData &data) { diff --git a/src/cc/eval.h b/src/cc/eval.h index d4581e8ef..5c6784086 100644 --- a/src/cc/eval.h +++ b/src/cc/eval.h @@ -110,7 +110,7 @@ public: virtual bool GetSpendsConfirmed(uint256 hash, std::vector &spends) const; virtual bool GetBlock(uint256 hash, CBlockIndex& blockIdx) const; virtual int32_t GetNotaries(uint8_t pubkeys[64][33], int32_t height, uint32_t timestamp) const; - virtual bool GetNotarizationData(uint256 notarisationHash, NotarizationData &data) const; + virtual bool GetNotarizationData(uint256 notarizationHash, NotarizationData &data) const; virtual bool CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t timestamp) const; virtual uint32_t GetAssetchainsCC() const; virtual std::string GetAssetchainsSymbol() const; @@ -158,7 +158,7 @@ extern char SMART_CHAIN_SYMBOL[65]; /* - * Data from notarisation OP_RETURN from chain being notarised + * Data from notarization OP_RETURN from chain being notarized */ class NotarizationData { diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index c8036e5f2..4a38c9daf 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -613,7 +613,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & return eval->Invalid(validationError); } else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if (myGetTransaction(deposittxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysdeposittxid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeGatewaysDepositOpRet(tmptx.vout[numvouts-1].scriptPubKey,tmptxid,tmprefcoin,tmppublishers,txids,height,cointxid,claimvout,hex,proof,tmppubkey,tmpamount) != 'D') @@ -631,7 +631,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if (tmpamount>totalsupply) return eval->Invalid("deposit amount greater then bind total supply"); else if (hush_txnotarizedconfirmed(deposittxid) == false) - return eval->Invalid("gatewaysdeposit tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysdeposit tx is not yet confirmed(notarized)!"); else if (tx.vin.size()>0) { i=0; @@ -705,7 +705,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if ( ConstrainVout(tmptx.vout[1],1,gatewaystokensaddr,amount)==0) return eval->Invalid("invalid tokens to gateways vout for gatewaysWithdraw!"); else if (hush_txnotarizedconfirmed(withdrawtxid) == false) - return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarized)!"); else if (myGetTransaction(bindtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysbind txid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,tmprefcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B') @@ -715,7 +715,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if (tmptokenid!=tokenid) return eval->Invalid("tokenid does not match tokenid from gatewaysbind"); else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if (IsCCInput(tx.vin[0].scriptSig) != 0) return eval->Invalid("vin.0 is normal for gatewayspartialsign!"); else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0 || myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0 || tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].nValue!=CC_MARKER_VALUE) @@ -747,7 +747,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if (tmptx.vout[1].nValue!=amount) return eval->Invalid("amount in opret not matching tx tokens amount!"); else if (hush_txnotarizedconfirmed(withdrawtxid) == false) - return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarized)!"); else if (myGetTransaction(bindtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysbind txid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,tmprefcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B') @@ -757,7 +757,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if (tmptokenid!=tokenid) return eval->Invalid("tokenid does not match tokenid from gatewaysbind"); else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if (IsCCInput(tx.vin[0].scriptSig) != 0) return eval->Invalid("vin.0 is normal for gatewayscompletesigning!"); else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0 || myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0 || tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].nValue!=CC_MARKER_VALUE) @@ -778,7 +778,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if ((numvouts=tmptx.vout.size()) > 0 && DecodeGatewaysCompleteSigningOpRet(tmptx.vout[numvouts-1].scriptPubKey,withdrawtxid,tmprefcoin,K,hex)!='S') return eval->Invalid("invalid gatewayscompletesigning OP_RETURN data!"); else if (hush_txnotarizedconfirmed(completetxid) == false) - return eval->Invalid("gatewayscompletesigning tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayscompletesigning tx is not yet confirmed(notarized)!"); else if (myGetTransaction(withdrawtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid withdraw txid!"); else if ((numvouts=tmptx.vout.size()) > 0 && DecodeGatewaysWithdrawOpRet(tmptx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,tmprefcoin,pubkey,amount)!='W') @@ -786,7 +786,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if (tmprefcoin!=refcoin) return eval->Invalid("refcoin different than in bind tx"); else if (hush_txnotarizedconfirmed(withdrawtxid) == false) - return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarized)!"); else if (myGetTransaction(bindtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysbind txid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeGatewaysBindOpRet(depositaddr,tmptx.vout[numvouts-1].scriptPubKey,tokenid,tmprefcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B') @@ -796,7 +796,7 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction & else if (tmptokenid!=tokenid) return eval->Invalid("tokenid does not match tokenid from gatewaysbind"); else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if ( IsCCInput(tx.vin[0].scriptSig) != 0 ) return eval->Invalid("vin.0 is normal for gatewaysmarkdone!"); else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0 || myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0 || tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].nValue!=CC_MARKER_VALUE) diff --git a/src/cc/importgateway.cpp b/src/cc/importgateway.cpp index 1afaeec94..12ab0f90e 100644 --- a/src/cc/importgateway.cpp +++ b/src/cc/importgateway.cpp @@ -361,7 +361,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if (tmptx.vout[1].nValue!=amount) return eval->Invalid("amount in opret not matching tx tokens amount!"); else if (hush_txnotarizedconfirmed(withdrawtxid) == false) - return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarized)!"); else if (myGetTransaction(bindtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysbind txid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeImportGatewayBindOpRet(burnaddr,tmptx.vout[numvouts-1].scriptPubKey,tmprefcoin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B') @@ -369,7 +369,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if (tmprefcoin!=refcoin) return eval->Invalid("refcoin different than in bind tx"); else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if (IsCCInput(tx.vin[0].scriptSig) != 0) return eval->Invalid("vin.0 is normal for gatewayspartialsign!"); else if ((*cp->ismyvin)(tx.vin[1].scriptSig) == 0 || myGetTransaction(tx.vin[1].prevout.hash,tmptx,hashblock)==0 || tmptx.vout[tx.vin[1].prevout.n].nValue!=CC_MARKER_VALUE) @@ -403,7 +403,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if (tmptx.vout[1].nValue!=amount) return eval->Invalid("amount in opret not matching tx tokens amount!"); else if (hush_txnotarizedconfirmed(withdrawtxid) == false) - return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarized)!"); else if (myGetTransaction(bindtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysbind txid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeImportGatewayBindOpRet(burnaddr,tmptx.vout[numvouts-1].scriptPubKey,tmprefcoin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B') @@ -411,7 +411,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if (tmprefcoin!=refcoin) return eval->Invalid("refcoin different than in bind tx"); else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if (IsCCInput(tx.vin[0].scriptSig) != 0) return eval->Invalid("vin.0 is normal for gatewayscompletesigning!"); else if ((*cp->ismyvin)(tx.vin[1].scriptSig) == 0 || myGetTransaction(tx.vin[1].prevout.hash,tmptx,hashblock)==0 || tmptx.vout[tx.vin[1].prevout.n].nValue!=CC_MARKER_VALUE) @@ -432,7 +432,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if ((numvouts=tmptx.vout.size()) > 0 && DecodeImportGatewayCompleteSigningOpRet(tmptx.vout[numvouts-1].scriptPubKey,withdrawtxid,tmprefcoin,K,hex)!='S') return eval->Invalid("invalid gatewayscompletesigning OP_RETURN data!"); else if (hush_txnotarizedconfirmed(completetxid) == false) - return eval->Invalid("gatewayscompletesigning tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayscompletesigning tx is not yet confirmed(notarized)!"); else if (myGetTransaction(withdrawtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid withdraw txid!"); else if ((numvouts=tmptx.vout.size()) > 0 && DecodeImportGatewayWithdrawOpRet(tmptx.vout[numvouts-1].scriptPubKey,bindtxid,tmprefcoin,pubkey,amount)!='W') @@ -440,7 +440,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if (tmprefcoin!=refcoin) return eval->Invalid("refcoin different than in bind tx"); else if (hush_txnotarizedconfirmed(withdrawtxid) == false) - return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewayswithdraw tx is not yet confirmed(notarized)!"); else if (myGetTransaction(bindtxid,tmptx,hashblock) == 0) return eval->Invalid("invalid gatewaysbind txid!"); else if ((numvouts=tmptx.vout.size()) < 1 || DecodeImportGatewayBindOpRet(burnaddr,tmptx.vout[numvouts-1].scriptPubKey,tmprefcoin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 'B') @@ -448,7 +448,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact else if (tmprefcoin!=refcoin) return eval->Invalid("refcoin different than in bind tx"); else if (hush_txnotarizedconfirmed(bindtxid) == false) - return eval->Invalid("gatewaysbind tx is not yet confirmed(notarised)!"); + return eval->Invalid("gatewaysbind tx is not yet confirmed(notarized)!"); else if ( IsCCInput(tx.vin[0].scriptSig) != 0 ) return eval->Invalid("vin.0 is normal for gatewaysmarkdone!"); else if ((*cp->ismyvin)(tx.vin[1].scriptSig) == 0 || myGetTransaction(tx.vin[1].prevout.hash,tmptx,hashblock)==0 || tmptx.vout[tx.vin[1].prevout.n].nValue!=CC_MARKER_VALUE) diff --git a/src/cc/importpayout.cpp b/src/cc/importpayout.cpp index a3fd90394..481e846f0 100644 --- a/src/cc/importpayout.cpp +++ b/src/cc/importpayout.cpp @@ -28,7 +28,7 @@ /* * Crypto-Condition EVAL method that verifies a payout against a transaction - * notarised on another chain. + * notarized on another chain. * * IN: params - condition params * IN: importTx - Payout transaction on value chain (HUSH) @@ -83,7 +83,7 @@ bool Eval::ImportPayout(const std::vector params, const CTransaction &i // Check disputeTx solves momproof from vout[0] { NotarizationData data; - if (!GetNotarizationData(proof.notarisationHash, data)) + if (!GetNotarizationData(proof.notarizationHash, data)) return Invalid("coudnt-load-mom"); if (data.MoM != proof.Exec(disputeTx.GetHash())) diff --git a/src/hush.h b/src/hush.h index ee9f608f2..68a5051ca 100644 --- a/src/hush.h +++ b/src/hush.h @@ -704,7 +704,7 @@ int32_t hush_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryi printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",SMART_CHAIN_SYMBOL,height,sp->NOTARIZED_HEIGHT,SMART_CHAIN_SYMBOL,srchash.ToString().c_str(),"HUSH",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); } //else if ( fJustCheck ) - // return (-3); // if the notarisation is only invalid because its out of order it cannot be mined in a block with a valid one! + // return (-3); // if the notarization is only invalid because its out of order it cannot be mined in a block with a valid one! } else if ( opretlen != 149 && height > 600000 && matched != 0 ) printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,SMART_CHAIN_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen); } @@ -764,7 +764,7 @@ int32_t hush_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys[6 int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; - std::vector notarisations; + std::vector notarizations; uint64_t signedmask,voutmask; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp; uint8_t scriptbuf[10001],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 zero,btctxid,txhash; int32_t i,j,k,numnotaries,notarized,scriptlen,isratification,nid,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count; @@ -897,8 +897,8 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) notaryid = hush_voutupdate(fJustCheck,&isratification,notaryid,scriptbuf,len,height,txhash,i,j,&voutmask,&specialtx,¬arizedheight,(uint64_t)block.vtx[i].vout[j].nValue,notarized,signedmask,(uint32_t)chainActive.LastTip()->GetBlockTime()); if ( fJustCheck && notaryid == -2 ) { - // We see a valid notarisation here, save its location. - notarisations.push_back(i); + // We see a valid notarization here, save its location. + notarizations.push_back(i); } if ( 0 && i > 0 ) { @@ -961,11 +961,11 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) //fprintf(stderr,"%s end connect.%d\n",SMART_CHAIN_SYMBOL,pindex->GetHeight()); if (fJustCheck) { - if ( notarisations.size() == 0 ) + if ( notarizations.size() == 0 ) return(0); - if ( notarisations.size() == 1 && notarisations[0] == 1 ) + if ( notarizations.size() == 1 && notarizations[0] == 1 ) return(1); - if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) ) + if ( notarizations.size() > 1 || (notarizations.size() == 1 && notarizations[0] != 1) ) return(-1); fprintf(stderr,"hush_connectblock: unxexpected behaviour when fJustCheck == true, report bug plz ! \n"); diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index 0aefbcccf..d690cc8a2 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -1375,7 +1375,7 @@ uint64_t hush_notarypayamount(int32_t nHeight, int64_t notarycount) int32_t hush_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len) { - // Check the notarisation is valid, and extract notarised height. + // Check the notarization is valid, and extract notarized height. uint64_t voutmask; uint8_t scriptbuf[10001]; int32_t isratification,specialtx,notarizedheight; @@ -1403,7 +1403,7 @@ uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector &Notariz if ( notarypubkeys[0][0] == 0 ) return(0); - // Check the notarisation is valid. + // Check the notarization is valid. int32_t notarizedheight = hush_getnotarizedheight(timestamp, height, script, len); if ( notarizedheight == 0 ) return(0); @@ -1416,7 +1416,7 @@ uint64_t hush_notarypay(CMutableTransaction &txNew, std::vector &Notariz if ( AmountToPay == 0 ) return(0); - // loop over notarisation vins and add transaction to coinbase. + // loop over notarization vins and add transaction to coinbase. // Commented prints here can be used to verify manually the pubkeys match. for (int8_t n = 0; n < NotarizationNotaries.size(); n++) { @@ -1468,10 +1468,10 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height) if ( !GetNotarizationNotaries(notarypubkeys, numSN, pblock->vtx[1].vin, NotarizationNotaries) ) return(0); - // check a notary didnt sign twice (this would be an invalid notarisation later on and cause problems) + // check a notary didnt sign twice (this would be an invalid notarization later on and cause problems) std::set checkdupes( NotarizationNotaries.begin(), NotarizationNotaries.end() ); if ( checkdupes.size() != NotarizationNotaries.size() ) { - fprintf(stderr, "Possible notarisation is signed multiple times by same notary. It is invalid.\n"); + fprintf(stderr, "Possible notarization is signed multiple times by same notary. It is invalid.\n"); return(0); } const CChainParams& chainparams = Params(); @@ -1480,7 +1480,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height) CMutableTransaction txNew = CreateNewContextualCMutableTransaction(consensusParams, height); if ( pblock->vtx[1].vout.size() == 2 && pblock->vtx[1].vout[1].nValue == 0 ) { - // Get the OP_RETURN for the notarisation + // Get the OP_RETURN for the notarization uint8_t *script = (uint8_t *)&pblock->vtx[1].vout[1].scriptPubKey[0]; int32_t scriptlen = (int32_t)pblock->vtx[1].vout[1].scriptPubKey.size(); if ( script[0] == OP_RETURN ) @@ -1491,13 +1491,13 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height) } else { - fprintf(stderr, "vout 2 of notarisation is not OP_RETURN scriptlen.%i\n", scriptlen); + fprintf(stderr, "vout 2 of notarization is not OP_RETURN scriptlen.%i\n", scriptlen); return(0); } } else return(0); - // if notarypay fails, because the notarisation is not valid, exit now as txNew was not created. - // This should never happen, as the notarisation is checked before this function is called. + // if notarypay fails, because the notarization is not valid, exit now as txNew was not created. + // This should never happen, as the notarization is checked before this function is called. if ( totalsats == 0 ) { fprintf(stderr, "notary pay returned 0!\n"); @@ -1519,7 +1519,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height) n++; continue; } - // Check the pubkeys match the pubkeys in the notarisation. + // Check the pubkeys match the pubkeys in the notarization. script = (uint8_t *)&txout.scriptPubKey[0]; scriptlen = (int32_t)txout.scriptPubKey.size(); if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,notarypubkeys[NotarizationNotaries[n-1]],33) == 0 ) @@ -1537,7 +1537,7 @@ uint64_t hush_checknotarypay(CBlock *pblock,int32_t height) } if ( matches != 0 && matches == NotarizationNotaries.size() && totalsats == total ) { - //fprintf(stderr, "Validated coinbase matches notarisation in tx position 1.\n" ); + //fprintf(stderr, "Validated coinbase matches notarization in tx position 1.\n" ); return(totalsats); } return(0); @@ -1757,10 +1757,10 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) // We check the full validation in ConnectBlock directly to get the amount for coinbase. So just approx here. if ( slowflag == 0 && pblock->vtx[0].vout.size() > 1 ) { - // Check the notarisation tx is to the crypto address. + // Check the notarization tx is to the crypto address. if ( !hush_is_notarytx(pblock->vtx[1]) == 1 ) { - fprintf(stderr, "notarisation is not to crypto address ht.%i\n",height); + fprintf(stderr, "notarization is not to crypto address ht.%i\n",height); return(-1); } // Check min sigs. diff --git a/src/main.cpp b/src/main.cpp index 4e6fc678f..7eba3e7a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5600,7 +5600,7 @@ bool PruneOneBlockFile(bool tempfile, const int fileNumber) } else { - // Block is not in main chain and is older than last notarised block so its safe for removal. + // Block is not in main chain and is older than last notarized block so its safe for removal. fprintf(stderr, "Block [%i] in tempfile.%i We can clear this block!\n",pindex->GetHeight(),fileNumber); // Add index to list and remove after loop? } diff --git a/src/notarizationdb.h b/src/notarizationdb.h index 53d4f7318..b6e3f7684 100644 --- a/src/notarizationdb.h +++ b/src/notarizationdb.h @@ -20,9 +20,9 @@ typedef std::vector NotarizationsInBlock; NotarizationsInBlock ScanBlockNotarizations(const CBlock &block, int nHeight); bool GetBlockNotarizations(uint256 blockHash, NotarizationsInBlock &nibs); -bool GetBackNotarization(uint256 notarisationHash, Notarization &n); -void WriteBackNotarizations(const NotarizationsInBlock notarisations, CDBBatch &batch); -void EraseBackNotarizations(const NotarizationsInBlock notarisations, CDBBatch &batch); +bool GetBackNotarization(uint256 notarizationHash, Notarization &n); +void WriteBackNotarizations(const NotarizationsInBlock notarizations, CDBBatch &batch); +void EraseBackNotarizations(const NotarizationsInBlock notarizations, CDBBatch &batch); int ScanNotarizationsDB(int height, std::string symbol, int scanLimitBlocks, Notarization& out); #endif /* HUSH_NOTARISATIONDB_H */ diff --git a/src/test-hush/test_eval_bet.cpp b/src/test-hush/test_eval_bet.cpp index 5ff210393..51c9eda42 100644 --- a/src/test-hush/test_eval_bet.cpp +++ b/src/test-hush/test_eval_bet.cpp @@ -123,9 +123,9 @@ public: return true; } - bool GetNotarizationData(uint256 notarisationHash, NotarizationData &data) const + bool GetNotarizationData(uint256 notarizationHash, NotarizationData &data) const { - if (notarisationHash == NotarizationHash()) { + if (notarizationHash == NotarizationHash()) { data.MoM = MoM; return true; } @@ -567,7 +567,7 @@ TEST_F(TestBet, testImportPayoutInvalidNotarizationHash) EvalMock eval = ebet.SetEvalMock(12); MoMProof proof = ebet.GetMoMProof(); - proof.notarisationHash = uint256(); + proof.notarizationHash = uint256(); CMutableTransaction importTx = ebet.bet.MakeImportPayoutTx( ebet.Payouts(Player2), ebet.DisputeTx(Player2), uint256(), proof); diff --git a/src/test-hush/test_parse_notarization.cpp b/src/test-hush/test_parse_notarization.cpp index 655c6d5b6..0ee04a817 100644 --- a/src/test-hush/test_parse_notarization.cpp +++ b/src/test-hush/test_parse_notarization.cpp @@ -49,6 +49,6 @@ TEST(TestParseNotarization, test__b) -// for l in `g 'parse notarisation' ~/.hush/HUSH3/debug.log | pyline 'l.split()[8]'`; do hoek decodeTx '{"hex":"'`src/hush-cli getrawtransaction "$l"`'"}' | jq '.outputs[1].script.op_return' | pyline 'import base64; print base64.b64decode(l).encode("hex")'; done +// for l in `g 'parse notarization' ~/.hush/HUSH3/debug.log | pyline 'l.split()[8]'`; do hoek decodeTx '{"hex":"'`src/hush-cli getrawtransaction "$l"`'"}' | jq '.outputs[1].script.op_return' | pyline 'import base64; print base64.b64decode(l).encode("hex")'; done }