Commit Graph

3735 Commits

Author SHA1 Message Date
Calvin Kim
f258d0c8d2 database/ffldb: Change scanBlockFiles behavior
This change is part of the effort to add pruning support to btcd.

scanBlockFiles nows supports scanning files from an arbitrary block
number.  When blocks are pruned, the file number may not start from 0.
To account for this, scanBlockFiles now scans and retreives the start
and the end block file numbers and scans those files.
2023-08-04 17:40:34 +09: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
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
martonp
a18c2cfbf8 Export MakeScritpNum, AsSmallInt, and IsSmallInt 2023-03-03 15:05:14 -05:00
Oliver Gugger
38331963bd
Merge pull request #1954 from guggero/script-builder-alloc
txscript: allow script builder capacity to be specified
2023-02-28 19:50:50 +01:00
Oliver Gugger
e1e4196fbc
txscript: allow script builder capacity to be specified
The default script builder allocates 500 bytes of memory for each
script. That is quite large for most applications and therefore wastes a
lot of memory when only small scripts are created.
To avoid breaking backward compatibility, we add a new functional option
to the NewScriptBuilder function that allows the user to specify the
initial allocation size.
2023-02-27 12:38:13 +01:00
Calvin Kim
902f797b0c txscript: Fix typo in IsUnspendable() comment
IsUnspendable allows outputs, not inputs to be pruned instantly.
2023-02-13 08:35:16 -05:00
Hristo Georgiev
52082fcbf9 docs: Update Go version as per the Readme. 2023-02-10 16:57:42 -05:00
Oliver Gugger
ecf98ce34f
Merge pull request #1942 from guggero/psbt-export
btcutil/psbt: export helper functions, fix/add encoding of unknown fields
2023-02-02 11:46:57 +01:00
Oliver Gugger
bb0a2f3790
psbt: add unit test for unknowns 2023-01-27 15:30:46 +01:00
Oliver Gugger
6c81c664bb
psbt: use pointer slice for global unknowns
To unify the way the unknown fields are handled, we change the global
ones to a slice of pointers as well. This makes it easier to add
generic handler code for unknown fields, if they are uniform across the
levels (global, input, output).
2023-01-27 15:30:45 +01:00
Oliver Gugger
5ebbb1bb91
psbt: encode global unknowns 2023-01-27 15:30:44 +01:00
Oliver Gugger
19c7c3d853
psbt: allow Unknowns in outputs 2023-01-27 15:30:43 +01:00
Oliver Gugger
2dbc98bdf3
psbt: fix formatting and typos 2023-01-27 15:30:42 +01:00
Oliver Gugger
734ab735b9
psbt: export Bip32 encode/decode functions 2023-01-27 15:30:41 +01:00
Olaoluwa Osuntokun
be056b0a0b
Merge pull request #1941 from Roasbeef/sighash-taproot-keyspend-bug-fix
Sighash taproot keyspend bug fix
2023-01-24 18:59:38 -08:00
Olaoluwa Osuntokun
d6efaa7208
txscript: add tests for RawTxInTaprootSignature and RawTxInTapscriptSignature
In this commit, we add tests for the public functions used to generate
keyspend and tapscript signatures. Without the prior commit, these tests
will fail as the keyspend function won't properly add the sighash bytes
for things that aren't sighash default.
2023-01-24 18:43:55 -08:00
Olaoluwa Osuntokun
5e0de1c539
txscript: add new PayToTaprootScript function 2023-01-24 18:43:50 -08:00
Olaoluwa Osuntokun
f6e8292402
txscript: fix sighash bug in RawTxInTaprootSignature
In this commit, we fix a bug in RawTxInTaprootSignature that would cause
the function to not properly apply the sighash flag for non-default
sighash signatures. The logic would end up applying `0x00` as a mask,
which will always be `0x00` on the other end.

The RawTxInTapscriptSignature function was correct, though it had the
ordering switched as it applies the sighash if the type doesn't equal
default.
2023-01-24 18:43:45 -08:00
Jens Schendel
016b3adb36
Update mining.md (#1938)
minor changes to increase readability.
2023-01-20 09:00:37 -05:00
Christopher Hall
1d77730e9a [connmgr] remove pending entry on failed connection
fix memory leak in connmanager caused by:

* pending entries are not removed on error
* new connection always allocates new struct
* capture id value for callback

Fix by calling Remove in both handleFailedConn callbacks to delete the
item from the pending hash map

Signed-off-by: Christopher Hall <hsw@bitmark.com>
2023-01-12 09:45:31 -05:00
Olaoluwa Osuntokun
977712a094
Merge pull request #1924 from guiand888/patch-1
Update Dockerfile to Alpine 3.16
2023-01-05 18:02:47 -08:00