From f15cdae1854d74b8f61973a24a8cfecf82abdd0d Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 8 Jul 2019 06:17:14 -1100 Subject: [PATCH] Use vintx! --- src/komodo_nSPV.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 4cc84729b..921879730 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -419,14 +419,21 @@ int32_t NSPV_txextract(CTransaction &tx,uint8_t *data,int32_t datalen) else return(-1); } +/* + NSPV_notariescount is the slowest process during full validation as it requires looking up 13 transactions. + one way that would be 10000x faster would be to bruteforce validate the signatures in each vin, against all 64 pubkeys! for a valid tx, that is on average 13*32 secp256k1/sapling verify operations, which is much faster than even a single network request. + Unfortunately, due to the complexity of calculating the hash to sign for a tx, this bruteforcing would require determining what type of signature method and having sapling vs legacy methods of calculating the txhash. + It could be that the fullnode side could calculate this and send it back to the superlite side as any hash that would validate 13 different ways has to be the valid txhash. + However, since the vouts being spent by the notaries are highly constrained p2pk vouts, the txhash can be deduced if a specific notary pubkey is indeed the signer + */ + int32_t NSPV_notariescount(CTransaction tx,uint8_t elected[64][33]) { uint8_t *script; CTransaction vintx; int32_t i,j,utxovout,scriptlen,numsigs = 0; for (i=0; i opret; - fprintf(stderr,"ntz vouts[%d]\n",(int32_t)tx.vout.size()); if ( tx.vout.size() >= 2 ) { symbol = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;