Commit Graph

3754 Commits

Author SHA1 Message Date
beerosagos
36278166e5
chainhash: add support to legacy-marshaled hashes
Recent commits 1d6e578 and 72ea23e introduced a change in the way Hashes
are serialized and deserialized. This change could cause errors in
downstream applications that persisted hashes serialized using the previous
methods.

This introduces support for legacy-serialized hashes unmarshaling and restores
the compatibility with previous versions.
2023-08-29 14:52:29 +02:00
Olaoluwa Osuntokun
40d7a0a06c
Merge pull request #2022 from wydengyre/bip-340-signing
schnorr: bip-340 compliant signing
2023-08-15 15:30:33 -07:00
Olaoluwa Osuntokun
201b608f31
Merge pull request #1980 from halseth/script-callback
txscript/engine: add execution StepCallback
2023-08-15 15:23:35 -07:00
wydengyre
1c0bc470e8 schnorr: bip-340 compliant signing
fixes https://github.com/btcsuite/btcd/issues/2021
2023-08-15 14:58:15 +01:00
Olaoluwa Osuntokun
0bed86b3f0
Merge pull request #2018 from wydengyre/bip340-schnorr-verification
schnorr: bip-340 compliant verification
2023-08-14 12:09:56 -07:00
wydengyre
ab9338ddbf schnorr: bip-340 compliant verification
fixes https://github.com/btcsuite/btcd/issues/2017
2023-08-12 10:09:27 +01:00
Olaoluwa Osuntokun
0aaa7c5e7b
Merge pull request #1979 from kcalvinalvin/merkle-calc-fast
blockchain, integration, mining, main: Rolling merkle root calculation
2023-08-10 15:05:40 -07:00
Olaoluwa Osuntokun
d776d9c105
Merge pull request #2016 from wydengyre/fix-docs-rfc6979
schnorr: correct rfc reference in docs
2023-08-09 16:46:55 -07:00
Johan T. Halseth
5c5bef0308
txscript/engine_debug_test: add TestDebugEngine
Add a simple test that make sure the stack and alt stack is correctly
set in the callback from script execution.
2023-08-07 14:22:42 +02:00
Johan T. Halseth
6d38900304
txscript/engine: add execution stepCallback
We add a new stepCallback as optional function closure on the Engine
that will be called every time a step has been performed during script
execution.

It is accessed by calling the NewDebugEngine constructor.

This is only meant to be used in debugging.
2023-08-07 14:22:42 +02:00
wydengyre
880d9f9026 schnorr: correct rfc reference in docs
The RFC used for deterministic nonce generation is rfc6979, not rfc6679. This commit fixes documentation in two places accordingly.
2023-08-03 18:49:26 +01:00
Conner Fromknecht
ecfbb7e5d8 blockchain, rpctest, mining, main: replace usage of BuildMerkleTreeStore with CalcMerkleRoot 2023-08-04 00:02:26 +09:00
Conner Fromknecht
025fa65c93 blockchain: Add CalcMerkleRoot
CalcMerkleRoot uses the rolling merkle root algorithm to calculate the
merkle root commitment inside the Bitcoin block header.  It allocates
significantly less memory than the BuildMerkleTreeStore function that's
currently in use (99.9% in an average block with 2000 txs).
2023-08-04 00:01:10 +09:00
Conner Fromknecht
2d23f94002 blockchain: Add benchmarks for Merkle root calculation 2023-08-04 00:00:51 +09:00
Conner Fromknecht
2bb6824067 blockchain: Add RollingMerkleTree
RollingMerkleTree is a much more memory efficient way of calculating the
merkle root of a tx commitment inside the bitcoin block header.  The
current way of calculating the merkle root allocates 2*N elements. With
the RollingMerkleTree, we are able to reduce the memory allocated to
log2(N).

This results in significant memory savings (99.9% in an average block),
allowing for a faster block verification.
2023-08-03 23:56:53 +09:00
Calvin Kim
3ba9feeeee blockchain, btcutil/bloom: BuildMerkleTreeStore returns chainhash.Hash
BuildMerkleTreeStore used to return a pointer, but it is changed to
return a chainhash.Hash directly.  This allows the compiler to make
optimizations in some cases and avoids a memory allocation.
2023-08-03 15:23:17 +09:00
Oliver Gugger
6f93d9f40d
Merge pull request #1969 from lindlof/rpc-address-align
Add address field (rpc client & server)
2023-08-03 08:17:30 +02:00
Olaoluwa Osuntokun
3a9e7e2376
Merge pull request #2006 from 0xEclair/sig_hash_type
fix: missing sighashtype when finalizing taproot keyspend signature
2023-07-23 16:01:22 +02:00
0xEclair
7f0fb2ad3b psbt: finalizer add proper sighash flag
psbt: fix missing sighash flag when finalizing
psbt: test finalizer add proper sighash flag
2023-07-17 18:35:13 +08:00
Olaoluwa Osuntokun
7faa9b2662
Merge pull request #2003 from sputn1ck/musig2_fix_early_nonce_gen
musig2: fix early nonce gen option
2023-07-11 15:28:09 -07:00
sputn1ck
883a03da99
musig2: add early nonce gen KnownSigners test
This commit changes the early nonce gen test to use the KnownSigners
Option for one of the contexts.
2023-07-11 14:01:37 +02:00
sputn1ck
8f84bb0e9b
musig2: fix early nonce gen option
Previously the early nonce generation option was not being respected
when creating the context, with the WithKnownSigners option being
used. This commit fixes that.
2023-07-11 14:01:36 +02:00
Olaoluwa Osuntokun
4933e35f61
Merge pull request #1996 from C-Otto/trailing-zeroes
btcutil: format BTC amounts with trailing zeroes
2023-07-10 13:56:01 -07:00
Carsten Otto
725b36bf09 btcutil: format BTC amounts with trailing zeroes
so that sat amounts can be read without counting zeroes

before:
 350sat = 0.0000035 BTC
3500sat = 0.000035 BTC

after:
 350sat = 0.00000350 BTC
3500sat = 0.00003500 BTC

fixes #1995
2023-07-04 18:19:07 +02:00
Olaoluwa Osuntokun
f5eeb10d03
Merge pull request #1931 from Crypt-iQ/export_header_funcs
blockchain: refactor and export header validation checks
2023-06-29 15:01:41 -04:00
eugene
ee6c0e1962
blockchain: export CheckBlockHeaderSanity as a library function 2023-06-29 14:45:32 -04:00
eugene
00d0edd5c4
blockchain: intro HeaderCtx, ChainCtx + refactor CheckBlockHeaderContext
This change will allow an external program to provide its own HeaderCtx
and ChainCtx and be able to perform contextual block header checks.
2023-06-29 14:45:30 -04:00
Oliver Gugger
f9cbff0d81
Merge pull request #1998 from web3-explore/master
multi: remove repetitive the
2023-06-26 16:25:24 +02:00
cui fliter
e160bb6922 multi: remove repetitive the
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-06-26 15:40:51 +08:00
Oliver Gugger
7fd5c1e92c
Merge pull request #1985 from guggero/pow-no-retargeting
blockchain+chaincfg: disable retargeting for regtest
2023-06-22 09:51:09 +02:00
Oliver Gugger
599d3619e8
blockchain+chaincfg: disable retargeting for regtest
This commit emulates the behavior of Bitcoin Core introduced in
https://github.com/bitcoin/bitcoin/pull/6853 that disables retargeting
of the required proof of work for regtest.
2023-06-22 09:25:40 +02:00
Olaoluwa Osuntokun
253b688c68
Merge pull request #1981 from kcalvinalvin/2023-05-16-run-gofmt
multi: Run gofmt on the entire repository
2023-06-21 12:00:35 -05:00
Calvin Kim
ba5407615d multi: Run gofmt on the entire repository
The doc formatting changes introduced in the recent go version is
increasing the diff for all of the new commits.  Formatting it all in
this commit will help the readability of future PRs by reducing the
diff.
2023-06-21 22:31:09 +09:00
Mikael Lindlof
e4c88c3a3e rpc: Add ScriptPubKeyResult address field 2023-06-06 21:57:01 +01:00
Olaoluwa Osuntokun
9c16d23918
Merge pull request #1879 from GeorgeTsagk/wire/outpoint-parse-string
Add wire.Outpoint parser from string
2023-05-24 19:40:36 -07:00
Olaoluwa Osuntokun
4749f7a8d3
Merge pull request #1977 from kcalvinalvin/fix-readme-min-version
main: Update README.md's minimum go version
2023-05-24 15:08:43 -07:00
Calvin Kim
c1a713e4ba docs: Update minimum Go version 2023-05-22 15:53:52 +09:00
Oliver Gugger
98e3c49544
Merge pull request #1972 from kcalvinalvin/utxoview-use-slices
blockchain: Use slices when fetching utxos
2023-05-11 10:04:55 +02:00
Oliver Gugger
1287f1e89a
Merge pull request #1953 from kcalvinalvin/add-memory-profiling
btcd: Add memory profiling flag
2023-05-10 14:17:01 +02:00
Calvin Kim
218c4754c6 main: Update README.md's minimum go version
The readme suggests a minimum version of 1.16 but the go.mod requires go
1.17.
2023-05-06 01:26:54 +09:00
Calvin Kim
5ede256f66 blockchain: Add benchmark for using a map vs a slice
Benchmark added to compare the performance of a map vs a slice when
fetching utxos.  The benchmark shows roughly 25% performance improvement
when using slices instead of a map.
2023-05-05 22:54:35 +09:00
Calvin Kim
cfb39f790f blockchain: Use slices when fetching utxos
Maps have a higher overhead than slices.  As slices can be used instead
of maps, we avoid the overhead of making a map.
2023-05-05 22:54:33 +09:00
Calvin Kim
52ede324be chaincfg: Update checkpoints
The latest checkpoints were from a few years back and hurts ibd.
The updated checkpoints are based off of bitcoin core's past assumvalid
blocks.
2023-04-20 09:42:17 -04:00
Oliver Gugger
d48e86438e
Merge pull request #1957 from hieblmi/fix-typos
txscript: fix typos
2023-04-20 12:50:39 +02:00
Slyghtning
42653cdcd2 txscript: fix script typos 2023-04-20 11:41:45 +02:00
Oliver Gugger
79751682f2
Merge pull request #1964 from ziggie1984/psbt-nil-pointer-bug
psbt: add verification method for utxo data
2023-03-22 20:53:10 +01:00
RycCheen
e0e4916afb Supplementary chainhash test cases 2023-03-21 08:12:58 -04:00
RycCheen
72ea23ed1e chainhash: JSON Unmarshal hash from appropriate string. 2023-03-21 08:12:58 -04:00
ziggie
b554add716
psbt: add verification method for psbt input data
the new InputsReadyToSign method makes sure that inputs have either
the nonWitnessUtxo or the witnessUtxo data set.
2023-03-21 09:09:42 +01:00
Calvin Kim
d628705118 btcd: Add memory profiling flag
Enables Go memory profiling.  If the cpuprofile shows a lot of time
spent on gc, it's useful to then do a memory profile to see where the
memory alloctions happen.

Unlike the --profile flag, this allows for easy generation of a memory
profile for the entire duration of which btcd has been running for in
various readble graphs.
2023-03-21 14:12:43 +09:00