Commit graph

3570 commits

Author SHA1 Message Date
Brannon King e0870db24e [lbry] mining: calculate claimtrie root hash for generate RPC 2022-05-24 00:01:45 -07:00
Brannon King 6784830246 [lbry] blockchain: clear statusValid upon statusValidateFailed is set
The status management of index does need some refactoring.
For now, we just manually clear the statusValid in every occurance
of statusValidateFailed being set.

Co-authored-by: Roy Lee <roylee17@gmail.com>
2022-05-24 00:01:45 -07:00
Brannon King 405897fa38 [lbry] blockchain: fix crash on unlock generate/invalidate loop 2022-05-24 00:01:45 -07:00
Roy Lee 64884458f9 [lbry] rpc, mining: fix generatetoaddress 2022-05-24 00:01:45 -07:00
Alex Grintsvayg 5537ebbf0c [lbry] rpc: add GetChainTips rpc command 2022-05-24 00:01:45 -07:00
Brannon King 1ea849d509 [lbry] rpc: added getchaintips RPC
remove btcjson dep in chainquery
2022-05-24 00:01:45 -07:00
Brannon King 73d8f4762f [lbry] rpc: import invalidate/reconsiderblock from bchd 2022-05-24 00:01:45 -07:00
Brannon King 81862c664e [lbry] rpc: import getnetworkinfo from bchd 2022-05-24 00:01:45 -07:00
Brannon King 5116f45617 [lbry] rpc: fix getblock reponse 2022-05-24 00:01:45 -07:00
Brannon King 3d8f36a505 [lbry] rpc: output segwit rule 2022-05-24 00:01:45 -07:00
Roy Lee 096dd3ff75 [lbry] rpcclient: fix http response resource leaking 2022-05-24 00:01:02 -07:00
Roy Lee fb3ef35189 [lbry] rpcclient: support SkipVerify of TLS certificate. (#39) 2022-05-23 23:53:30 -07:00
Roy Lee 3111601ac9 [lbry] rpcclient: add a blocknotify example using lbcd websocket 2022-05-23 23:53:30 -07:00
Brannon King e7d8637cc5 [lbry] rpcclient: update defaultMaxFeeRate from 0.1 LBC to 0.5 LBC 2022-05-23 23:53:30 -07:00
Brannon King 9d70ff6f6d [lbry] rpcserver: add ClaimTrie root hash to GetBlockTemplate() 2022-05-23 23:53:30 -07:00
Brannon King 6834591d52 [lbry] rpc: support claim related methods 2022-05-23 23:53:30 -07:00
Brannon King 0c5f94420a [lbry] print out memory usage periodically 2022-05-23 23:53:30 -07:00
Roy Lee 6828cf5e36 [lbry] claimtrie: import current snapshot
Sync to tip

Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00
Roy Lee 45627c7a6a [lbry] rename btcd to lbcd
Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00
Roy Lee aae5b24bb0 [lbry] blockchain: connect to ClaimTrie
Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00
Brannon King ba22414cc1 [lbry] log: support claimtrie entries 2022-05-23 23:53:30 -07:00
Brannon King 78d780263b [lbry] txscript: remove claim prefix for addr calculation 2022-05-23 23:53:30 -07:00
Roy Lee 61a18152e9 [lbry] txscript: recognize LBRY claim script OPCODES 2022-05-23 23:53:30 -07:00
Roy Lee 2b28dfa528 [lbry] txscript: introduce claim script
Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00
Roy Lee 7657419b22 [lbry] txscript: change MaxScriptSize from 10,000 to 20,005 2022-05-23 23:53:30 -07:00
Alex Grintsvayg 33328a3e93 [lbry] server: make uptime rpc return a real uptime 2022-05-23 23:53:30 -07:00
Brannon King 44dd82a9f5 [lbry] server: don't ban peers on tx-not-in-block behavior 2022-05-23 23:53:30 -07:00
Roy Lee 93481d7f3a [lbry] server: update client version to /btcwire:0.5.0/LBRY.GO:0.12.2/
TODO: double check if lbryd bumps the version.
2022-05-23 23:53:30 -07:00
Brannon King 4eb4dfa670 [lbry] blockchain: Consider a block with timestamp less 6 hours 'current' 2022-05-23 23:53:30 -07:00
Brannon King 8ff0f3787e [lbry] blockchain: support force active fork deployment 2022-05-23 23:53:29 -07:00
Roy Lee 4a987b068d [lbry] blockchain, mempool: validate txscripts
Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:29 -07:00
Roy Lee 767a375816 [lbry] blockchain: change Block Subsidy algorithm 2022-05-23 23:53:29 -07:00
Roy Lee e63ede0311 [lbry] blockchain: change the difficulty adjustment algorithm.
adjusted := target + (actual - target) / 8

  max := target + (target / 2)
  min := target - (target / 8)

  if adjusted > max {
    adjusted = max
  } else if adj < min {
    adjusted = min
  }

  diffculty := lastDifficulty * adjusted / target
2022-05-23 23:53:29 -07:00
Roy Lee 4bfd69e23d [lbry] blockchain: make UTXO in Genesis block spendable 2022-05-23 23:53:29 -07:00
Roy Lee b2d0ae301e [lbry] blockchain, txscript: change maxScriptElementSize from 520 t0 20,000 bytes 2022-05-23 23:53:29 -07:00
Roy Lee 03989a91d9 [lbry] blockchain, wire: verify blockheaders using LBRY PoW 2022-05-23 23:53:29 -07:00
Roy Lee 9f479837c1 [lbry] blockchain: change max block size to 2,000,000 2022-05-23 23:53:29 -07:00
Roy Lee 3dc91f1295 [lbry] blockchain, wire: add ClaimTrie to Block Header 2022-05-23 23:53:29 -07:00
Roy Lee cbac056756 [lbry] chaincfg: update chainparams for LBRY chain
Co-authored-by: Brannon King <countprimes@gmail.com>
Co-authored-by: Alex Grintsvayg <grin@lbry.com>
2022-05-23 23:53:29 -07:00
Roy Lee ba3ca3b77e [lbry] chaincfg: setup genisis blocks 2022-05-23 23:53:29 -07:00
Roy Lee 21ad6495b6 [lbry] chaincfg: implement LBRY PoW Hash 2022-05-23 23:53:29 -07:00
Brannon King dba1eb7261 [lbry] profile: support fgprof (flame graph) 2022-05-23 23:53:29 -07:00
Roy Lee 31d3d9debc [lbry] wire: increase wire.MaxBlockPayload to 8MB 2022-05-23 23:53:29 -07:00
Roy Lee abe121ea6e [lbry] wire: update protocol NetIDs 2022-05-23 21:46:22 -07:00
Brannon King 2c3c4db198 [lbry] wire: optimize binaryFreeList handling 2022-05-23 21:46:22 -07:00
Tomasz Ziolkowski a8ad257660 reduce redundant memory allocatio - resolves btcsuite/btcd#1699
Signed-off-by: Tomasz Ziolkowski <tomasz.ziolkowski@allegro.pl>
2022-05-23 21:46:22 -07:00
Calvin Kim 40dab558f6 go.mod, go.sum: Update goleveldb
Goleveldb recently had a PR in where memory allocation was reduced
drastically (github.com/syndtr/goleveldb/pull/367).  Update goleveldb
to use that PR.
2022-05-23 21:46:22 -07:00
Dave Collins 42310f6948 txscript: Make op callbacks take opcode and data.
This converts the callback function defined on the internal opcode
struct to accept the opcode and data slice instead of a parsed opcode as
the final step towards removing the parsed opcode struct and associated
supporting code altogether.

It also updates all of the callbacks and tests accordingly and finally
removes the now unused parsedOpcode struct.

The final results for the raw script analysis and tokenizer
optimizations are as follows:

benchmark                                       old ns/op     new ns/op     delta
BenchmarkIsPayToScriptHash-8                    62393         0.51          -100.00%
BenchmarkIsPubKeyHashScript-8                   62228         0.56          -100.00%
BenchmarkGetSigOpCount-8                        61051         658           -98.92%
BenchmarkExtractPkScriptAddrsLarge-8            60713         17.2          -99.97%
BenchmarkExtractPkScriptAddrs-8                 289           17.9          -93.81%
BenchmarkIsWitnessPubKeyHash-8                  61688         0.42          -100.00%
BenchmarkIsUnspendable-8                        656           520           -20.73%
BenchmarkExtractAtomicSwapDataPushesLarge-8     61332         44.0          -99.93%
BenchmarkExtractAtomicSwapDataPushes-8          990           260           -73.74%
BenchmarkDisasmString-8                         102902        39754         -61.37%
BenchmarkGetPreciseSigOpCount-8                 130223        715           -99.45%
BenchmarkScriptParsing-8                        63464         681           -98.93%
BenchmarkIsMultisigScriptLarge-8                64166         5.83          -99.99%
BenchmarkIsMultisigScript-8                     630           58.5          -90.71%
BenchmarkPushedData-8                           64837         1779          -97.26%
BenchmarkCalcSigHash-8                          3627895       3605459       -0.62%
BenchmarkIsPubKeyScript-8                       62323         2.83          -100.00%
BenchmarkIsPushOnlyScript-8                     62412         569           -99.09%
BenchmarkIsWitnessScriptHash-8                  61243         0.56          -100.00%
BenchmarkGetScriptClass-8                       61515         16.4          -99.97%
BenchmarkIsNullDataScript-8                     62495         2.53          -100.00%
BenchmarkIsMultisigSigScriptLarge-8             69328         2.52          -100.00%
BenchmarkIsMultisigSigScript-8                  2375          141           -94.06%
BenchmarkGetWitnessSigOpCountP2WKH-8            504           72.0          -85.71%
BenchmarkGetWitnessSigOpCountNested-8           1158          136           -88.26%
BenchmarkIsWitnessPubKeyHash-8                  68927         0.53          -100.00%
BenchmarkIsWitnessScriptHash-8                  62774         0.63          -100.00%

benchmark                                       old allocs     new allocs     delta
BenchmarkIsPayToScriptHash-8                    1              0              -100.00%
BenchmarkIsPubKeyHashScript-8                   1              0              -100.00%
BenchmarkGetSigOpCount-8                        1              0              -100.00%
BenchmarkExtractPkScriptAddrsLarge-8            1              0              -100.00%
BenchmarkExtractPkScriptAddrs-8                 1              0              -100.00%
BenchmarkIsWitnessPubKeyHash-8                  1              0              -100.00%
BenchmarkIsUnspendable-8                        1              0              -100.00%
BenchmarkExtractAtomicSwapDataPushesLarge-8     1              0              -100.00%
BenchmarkExtractAtomicSwapDataPushes-8          2              1              -50.00%
BenchmarkDisasmString-8                         46             51             +10.87%
BenchmarkGetPreciseSigOpCount-8                 3              0              -100.00%
BenchmarkScriptParsing-8                        1              0              -100.00%
BenchmarkIsMultisigScriptLarge-8                1              0              -100.00%
BenchmarkIsMultisigScript-8                     1              0              -100.00%
BenchmarkPushedData-8                           7              6              -14.29%
BenchmarkCalcSigHash-8                          1335           712            -46.67%
BenchmarkIsPubKeyScript-8                       1              0              -100.00%
BenchmarkIsPushOnlyScript-8                     1              0              -100.00%
BenchmarkIsWitnessScriptHash-8                  1              0              -100.00%
BenchmarkGetScriptClass-8                       1              0              -100.00%
BenchmarkIsNullDataScript-8                     1              0              -100.00%
BenchmarkIsMultisigSigScriptLarge-8             5              0              -100.00%
BenchmarkIsMultisigSigScript-8                  3              0              -100.00%
BenchmarkGetWitnessSigOpCountP2WKH-8            2              0              -100.00%
BenchmarkGetWitnessSigOpCountNested-8           4              0              -100.00%
BenchmarkIsWitnessPubKeyHash-8                  1              0              -100.00%
BenchmarkIsWitnessScriptHash-8                  1              0              -100.00%

benchmark                                       old bytes     new bytes     delta
BenchmarkIsPayToScriptHash-8                    311299        0             -100.00%
BenchmarkIsPubKeyHashScript-8                   311299        0             -100.00%
BenchmarkGetSigOpCount-8                        311299        0             -100.00%
BenchmarkExtractPkScriptAddrsLarge-8            311299        0             -100.00%
BenchmarkExtractPkScriptAddrs-8                 768           0             -100.00%
BenchmarkIsWitnessPubKeyHash-8                  311299        0             -100.00%
BenchmarkIsUnspendable-8                        1             0             -100.00%
BenchmarkExtractAtomicSwapDataPushesLarge-8     311299        0             -100.00%
BenchmarkExtractAtomicSwapDataPushes-8          3168          96            -96.97%
BenchmarkDisasmString-8                         389324        130552        -66.47%
BenchmarkGetPreciseSigOpCount-8                 623367        0             -100.00%
BenchmarkScriptParsing-8                        311299        0             -100.00%
BenchmarkIsMultisigScriptLarge-8                311299        0             -100.00%
BenchmarkIsMultisigScript-8                     2304          0             -100.00%
BenchmarkPushedData-8                           312816        1520          -99.51%
BenchmarkCalcSigHash-8                          1373812       1290507       -6.06%
BenchmarkIsPubKeyScript-8                       311299        0             -100.00%
BenchmarkIsPushOnlyScript-8                     311299        0             -100.00%
BenchmarkIsWitnessScriptHash-8                  311299        0             -100.00%
BenchmarkGetScriptClass-8                       311299        0             -100.00%
BenchmarkIsNullDataScript-8                     311299        0             -100.00%
BenchmarkIsMultisigSigScriptLarge-8             330035        0             -100.00%
BenchmarkIsMultisigSigScript-8                  9472          0             -100.00%
BenchmarkGetWitnessSigOpCountP2WKH-8            1408          0             -100.00%
BenchmarkGetWitnessSigOpCountNested-8           3200          0             -100.00%
BenchmarkIsWitnessPubKeyHash-8                  311299        0             -100.00%
BenchmarkIsWitnessScriptHash-8                  311299        0             -100.00%
2022-05-23 21:46:22 -07:00
Dave Collins 7358671e83 txscript: Make executeOpcode take opcode and data.
This converts the executeOpcode function defined on the engine to accept
an opcode and data slice instead of a parsed opcode as a step towards
removing the parsed opcode struct and associated supporting code altogether.

It also updates all callers accordingly.
2022-05-23 21:46:21 -07:00
Dave Collins 6f3f4c1b8c txscript: Remove unused parseScriptTemplate func.
Also remove tests associated with the func accordingly.
2022-05-23 21:46:21 -07:00