diff --git a/Makefile b/Makefile index 08a9d36709..cb0d4e6640 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PKG := github.com/ltcsuite/ltcd +PKG := github.com/ltcmweb/ltcd LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint GOACC_PKG := github.com/ory/go-acc diff --git a/addrmgr/addrmanager.go b/addrmgr/addrmanager.go index 357be34952..75c848053f 100644 --- a/addrmgr/addrmanager.go +++ b/addrmgr/addrmanager.go @@ -23,8 +23,8 @@ import ( "sync/atomic" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // AddrManager provides a concurrency safe address manager for caching potential diff --git a/addrmgr/addrmanager_internal_test.go b/addrmgr/addrmanager_internal_test.go index ec1602f0b0..9bdf5f8458 100644 --- a/addrmgr/addrmanager_internal_test.go +++ b/addrmgr/addrmanager_internal_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // randAddr generates a *wire.NetAddressV2 backed by a random IPv4/IPv6 diff --git a/addrmgr/addrmanager_test.go b/addrmgr/addrmanager_test.go index aab5aef522..2ebd92cb0b 100644 --- a/addrmgr/addrmanager_test.go +++ b/addrmgr/addrmanager_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/addrmgr" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/addrmgr" + "github.com/ltcmweb/ltcd/wire" ) // naTest is used to describe a test to be performed against the NetAddressKey diff --git a/addrmgr/internal_test.go b/addrmgr/internal_test.go index 52d012e85c..d2136fdcbb 100644 --- a/addrmgr/internal_test.go +++ b/addrmgr/internal_test.go @@ -7,7 +7,7 @@ package addrmgr import ( "time" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) func TstKnownAddressIsBad(ka *KnownAddress) bool { diff --git a/addrmgr/knownaddress.go b/addrmgr/knownaddress.go index f90be48694..01bfb76b07 100644 --- a/addrmgr/knownaddress.go +++ b/addrmgr/knownaddress.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // KnownAddress tracks information about a known network address that is used diff --git a/addrmgr/knownaddress_test.go b/addrmgr/knownaddress_test.go index 1d5307d329..121c1fa29b 100644 --- a/addrmgr/knownaddress_test.go +++ b/addrmgr/knownaddress_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/addrmgr" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/addrmgr" + "github.com/ltcmweb/ltcd/wire" ) func TestChance(t *testing.T) { diff --git a/addrmgr/network.go b/addrmgr/network.go index 13e63a1b54..deb2bd747b 100644 --- a/addrmgr/network.go +++ b/addrmgr/network.go @@ -8,7 +8,7 @@ import ( "fmt" "net" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/addrmgr/network_test.go b/addrmgr/network_test.go index 32ab50fc4d..5267a0fd45 100644 --- a/addrmgr/network_test.go +++ b/addrmgr/network_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/addrmgr" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/addrmgr" + "github.com/ltcmweb/ltcd/wire" ) // TestIPTypes ensures the various functions which determine the type of an IP diff --git a/blockchain/README.md b/blockchain/README.md index 65442d35c8..a0c1af1204 100644 --- a/blockchain/README.md +++ b/blockchain/README.md @@ -21,7 +21,7 @@ block chain. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/blockchain +$ go get -u github.com/ltcmweb/ltcd/blockchain ``` ## Litecoin Chain Processing Overview diff --git a/blockchain/accept.go b/blockchain/accept.go index a8d273e509..d81d850ad4 100644 --- a/blockchain/accept.go +++ b/blockchain/accept.go @@ -7,8 +7,8 @@ package blockchain import ( "fmt" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" ) // maybeAcceptBlock potentially accepts a block into the block chain and, if diff --git a/blockchain/bench_test.go b/blockchain/bench_test.go index 5ae8480622..a3e48131fb 100644 --- a/blockchain/bench_test.go +++ b/blockchain/bench_test.go @@ -7,8 +7,8 @@ package blockchain import ( "testing" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // BenchmarkIsCoinBase performs a simple benchmark against the IsCoinBase diff --git a/blockchain/blockindex.go b/blockchain/blockindex.go index 0c5dd8ab75..2c110a0166 100644 --- a/blockchain/blockindex.go +++ b/blockchain/blockindex.go @@ -10,10 +10,10 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/wire" ) // blockStatus is a bit field representing the validation state of the block. diff --git a/blockchain/chain.go b/blockchain/chain.go index 471cc0ee44..0a299a5e0b 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -11,12 +11,12 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/chain_test.go b/blockchain/chain_test.go index d609a0c83a..975e0df4a9 100644 --- a/blockchain/chain_test.go +++ b/blockchain/chain_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // TestHaveBlock tests the HaveBlock API to ensure proper functionality. diff --git a/blockchain/chainio.go b/blockchain/chainio.go index 68bb7eca07..7e13c17b9f 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -12,10 +12,10 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/chainio_test.go b/blockchain/chainio_test.go index a5b1bc4567..0b24ce116b 100644 --- a/blockchain/chainio_test.go +++ b/blockchain/chainio_test.go @@ -11,8 +11,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/wire" ) // TestErrNotInMainChain ensures the functions related to errNotInMainChain work diff --git a/blockchain/chainview_test.go b/blockchain/chainview_test.go index 6f13c1ed9f..a8e626cc54 100644 --- a/blockchain/chainview_test.go +++ b/blockchain/chainview_test.go @@ -10,7 +10,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // testNoncePrng provides a deterministic prng for the nonce in generated fake diff --git a/blockchain/checkpoints.go b/blockchain/checkpoints.go index f04784af3e..7eb15b822b 100644 --- a/blockchain/checkpoints.go +++ b/blockchain/checkpoints.go @@ -8,10 +8,10 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" ) // CheckpointConfirmations is the number of blocks before the end of the current diff --git a/blockchain/common_test.go b/blockchain/common_test.go index 6ee680dc1d..b81a19650b 100644 --- a/blockchain/common_test.go +++ b/blockchain/common_test.go @@ -14,13 +14,13 @@ import ( "strings" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/compress.go b/blockchain/compress.go index 33a257674e..d0b380d671 100644 --- a/blockchain/compress.go +++ b/blockchain/compress.go @@ -5,8 +5,8 @@ package blockchain import ( - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/txscript" ) // ----------------------------------------------------------------------------- diff --git a/blockchain/difficulty.go b/blockchain/difficulty.go index 0ea6aa07ef..33118c5c8f 100644 --- a/blockchain/difficulty.go +++ b/blockchain/difficulty.go @@ -8,7 +8,7 @@ import ( "math/big" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) var ( diff --git a/blockchain/example_test.go b/blockchain/example_test.go index 46bbae2d90..f8482c512c 100644 --- a/blockchain/example_test.go +++ b/blockchain/example_test.go @@ -10,11 +10,11 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" ) // This example demonstrates how to create a new chain instance and use diff --git a/blockchain/fullblocks_test.go b/blockchain/fullblocks_test.go index 05f7b0d5a5..a2014da27a 100644 --- a/blockchain/fullblocks_test.go +++ b/blockchain/fullblocks_test.go @@ -10,12 +10,12 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/fullblocktests/README.md b/blockchain/fullblocktests/README.md index 7a6799a0b8..fcaa68829b 100644 --- a/blockchain/fullblocktests/README.md +++ b/blockchain/fullblocktests/README.md @@ -20,7 +20,7 @@ of blocks that exercise the consensus validation rules. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/blockchain/fullblocktests +$ go get -u github.com/ltcmweb/ltcd/blockchain/fullblocktests ``` ## License diff --git a/blockchain/fullblocktests/generate.go b/blockchain/fullblocktests/generate.go index 9d5e2ca19b..8c69d60279 100644 --- a/blockchain/fullblocktests/generate.go +++ b/blockchain/fullblocktests/generate.go @@ -18,13 +18,13 @@ import ( "runtime" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/fullblocktests/params.go b/blockchain/fullblocktests/params.go index 8f8f12d3e1..49cd57335e 100644 --- a/blockchain/fullblocktests/params.go +++ b/blockchain/fullblocktests/params.go @@ -9,9 +9,9 @@ import ( "math/big" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // newHashFromStr converts the passed big-endian hex string into a diff --git a/blockchain/indexers/README.md b/blockchain/indexers/README.md index 46fe10eaad..1815a4cea9 100644 --- a/blockchain/indexers/README.md +++ b/blockchain/indexers/README.md @@ -23,7 +23,7 @@ via an RPC interface. ## Installation ```bash -$ go get -u github.com/ltcsuite/ltcd/blockchain/indexers +$ go get -u github.com/ltcmweb/ltcd/blockchain/indexers ``` ## License diff --git a/blockchain/indexers/addrindex.go b/blockchain/indexers/addrindex.go index 17cddae870..1382d38071 100644 --- a/blockchain/indexers/addrindex.go +++ b/blockchain/indexers/addrindex.go @@ -9,13 +9,13 @@ import ( "fmt" "sync" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/indexers/addrindex_test.go b/blockchain/indexers/addrindex_test.go index 438eb4d819..87f3b99a10 100644 --- a/blockchain/indexers/addrindex_test.go +++ b/blockchain/indexers/addrindex_test.go @@ -9,7 +9,7 @@ import ( "fmt" "testing" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // addrIndexBucket provides a mock address index database bucket by implementing diff --git a/blockchain/indexers/blocklogger.go b/blockchain/indexers/blocklogger.go index c34a96a409..a25648f254 100644 --- a/blockchain/indexers/blocklogger.go +++ b/blockchain/indexers/blocklogger.go @@ -9,7 +9,7 @@ import ( "time" "github.com/btcsuite/btclog" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) // blockProgressLogger provides periodic logging for other services in order diff --git a/blockchain/indexers/cfindex.go b/blockchain/indexers/cfindex.go index 2ab91df235..1aa220f58d 100644 --- a/blockchain/indexers/cfindex.go +++ b/blockchain/indexers/cfindex.go @@ -7,14 +7,14 @@ package indexers import ( "errors" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/gcs" - "github.com/ltcsuite/ltcd/ltcutil/gcs/builder" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/gcs" + "github.com/ltcmweb/ltcd/ltcutil/gcs/builder" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/indexers/common.go b/blockchain/indexers/common.go index 8289dda8a3..d4ccac9acd 100644 --- a/blockchain/indexers/common.go +++ b/blockchain/indexers/common.go @@ -11,9 +11,9 @@ import ( "encoding/binary" "errors" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" ) var ( diff --git a/blockchain/indexers/manager.go b/blockchain/indexers/manager.go index 1abde6a73b..f96cd2c034 100644 --- a/blockchain/indexers/manager.go +++ b/blockchain/indexers/manager.go @@ -8,11 +8,11 @@ import ( "bytes" "fmt" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/blockchain/indexers/txindex.go b/blockchain/indexers/txindex.go index 80fdf943d7..5c0e86dbbd 100644 --- a/blockchain/indexers/txindex.go +++ b/blockchain/indexers/txindex.go @@ -8,11 +8,11 @@ import ( "errors" "fmt" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/interfaces.go b/blockchain/interfaces.go index d4f28c08e2..cb34aac940 100644 --- a/blockchain/interfaces.go +++ b/blockchain/interfaces.go @@ -1,8 +1,8 @@ package blockchain import ( - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // ChainCtx is an interface that abstracts away blockchain parameters. diff --git a/blockchain/merkle.go b/blockchain/merkle.go index c460029266..c31c60c66e 100644 --- a/blockchain/merkle.go +++ b/blockchain/merkle.go @@ -9,9 +9,9 @@ import ( "fmt" "math" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" ) const ( diff --git a/blockchain/merkle_test.go b/blockchain/merkle_test.go index cad648f563..19d85fd718 100644 --- a/blockchain/merkle_test.go +++ b/blockchain/merkle_test.go @@ -8,9 +8,9 @@ import ( "fmt" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" "github.com/stretchr/testify/require" ) diff --git a/blockchain/notifications_test.go b/blockchain/notifications_test.go index 47d63e214b..054a02d5ec 100644 --- a/blockchain/notifications_test.go +++ b/blockchain/notifications_test.go @@ -7,7 +7,7 @@ package blockchain import ( "testing" - "github.com/ltcsuite/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg" ) // TestNotifications ensures that notification callbacks are fired on events. diff --git a/blockchain/process.go b/blockchain/process.go index b34f2b6e3d..4507e7df0d 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -8,9 +8,9 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" ) // BehaviorFlags is a bitmask defining tweaks to the normal behavior when diff --git a/blockchain/rolling_merkle.go b/blockchain/rolling_merkle.go index 18502caf1f..9760e5cb2b 100644 --- a/blockchain/rolling_merkle.go +++ b/blockchain/rolling_merkle.go @@ -3,8 +3,8 @@ package blockchain import ( "math/bits" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" ) // rollingMerkleTreeStore calculates the merkle root by only allocating O(logN) diff --git a/blockchain/rolling_merkle_test.go b/blockchain/rolling_merkle_test.go index dc7734e7db..cda66b4f82 100644 --- a/blockchain/rolling_merkle_test.go +++ b/blockchain/rolling_merkle_test.go @@ -3,7 +3,7 @@ package blockchain import ( "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" "github.com/stretchr/testify/require" ) diff --git a/blockchain/scriptval.go b/blockchain/scriptval.go index a8ec461359..4d195043ee 100644 --- a/blockchain/scriptval.go +++ b/blockchain/scriptval.go @@ -10,9 +10,9 @@ import ( "runtime" "time" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // txValidateItem holds a transaction along with which input to validate. diff --git a/blockchain/thresholdstate.go b/blockchain/thresholdstate.go index c834545c85..0c7eadf051 100644 --- a/blockchain/thresholdstate.go +++ b/blockchain/thresholdstate.go @@ -8,8 +8,8 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // ThresholdState define the various threshold states used when voting on diff --git a/blockchain/thresholdstate_test.go b/blockchain/thresholdstate_test.go index 17b8a4b96a..0097a281f5 100644 --- a/blockchain/thresholdstate_test.go +++ b/blockchain/thresholdstate_test.go @@ -7,7 +7,7 @@ package blockchain import ( "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestThresholdStateStringer tests the stringized output for the diff --git a/blockchain/upgrade.go b/blockchain/upgrade.go index 053b15fc25..d2c3b327b8 100644 --- a/blockchain/upgrade.go +++ b/blockchain/upgrade.go @@ -11,9 +11,9 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/blockchain/utxoviewpoint.go b/blockchain/utxoviewpoint.go index c571a000a3..4a42b4a847 100644 --- a/blockchain/utxoviewpoint.go +++ b/blockchain/utxoviewpoint.go @@ -7,11 +7,11 @@ package blockchain import ( "fmt" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // txoFlags is a bitmask defining additional information and state for a diff --git a/blockchain/validate.go b/blockchain/validate.go index a66ef126e1..6328b7f3ac 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -11,11 +11,11 @@ import ( "math/big" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( @@ -114,6 +114,31 @@ func IsCoinBase(tx *ltcutil.Tx) bool { return IsCoinBaseTx(tx.MsgTx()) } +// IsHogExTx determines whether or not a transaction is probably a +// MWEB HogEx transaction. +func IsHogExTx(msgTx *wire.MsgTx) bool { + if msgTx.IsHogEx { + return true + } + + if len(msgTx.TxIn) == 0 || len(msgTx.TxOut) == 0 { + return false + } + + if msgTx.TxIn[0].PreviousOutPoint.Index != 0 { + return false + } + + ver, prog, err := txscript.ExtractWitnessProgramInfo( + msgTx.TxOut[0].PkScript, + ) + if err != nil { + return false + } + + return ver == txscript.MwebHogAddrWitnessVersion && len(prog) == 32 +} + // SequenceLockActive determines if a transaction's sequence locks have been // met, meaning that all the inputs of a given transaction have reached a // height or time sufficient for their relative lock-time maturity. diff --git a/blockchain/validate_test.go b/blockchain/validate_test.go index d3fa0f2f48..44925ba29d 100644 --- a/blockchain/validate_test.go +++ b/blockchain/validate_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // TestSequenceLocksActive tests the SequenceLockActive function to ensure it diff --git a/blockchain/versionbits.go b/blockchain/versionbits.go index 6df7215afe..18e683377e 100644 --- a/blockchain/versionbits.go +++ b/blockchain/versionbits.go @@ -5,7 +5,7 @@ package blockchain import ( - "github.com/ltcsuite/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg" ) const ( @@ -157,7 +157,8 @@ func (c deploymentChecker) HasStarted(blkNode *blockNode) bool { // Can't fail as we make sure to set the clock above when we // instantiate *BlockChain. header := blkNode.Header() - started, _ := c.deployment.DeploymentStarter.HasStarted(&header) + started, _ := c.deployment.DeploymentStarter.HasStarted( + &header, blkNode.height) return started } @@ -173,7 +174,8 @@ func (c deploymentChecker) HasEnded(blkNode *blockNode) bool { // Can't fail as we make sure to set the clock above when we // instantiate *BlockChain. header := blkNode.Header() - ended, _ := c.deployment.DeploymentEnder.HasEnded(&header) + ended, _ := c.deployment.DeploymentEnder.HasEnded( + &header, blkNode.height) return ended } diff --git a/blockchain/weight.go b/blockchain/weight.go index e27ec124b6..f7c4287d7a 100644 --- a/blockchain/weight.go +++ b/blockchain/weight.go @@ -7,9 +7,9 @@ package blockchain import ( "fmt" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/btcd.go b/btcd.go index 80cddb3f60..37cc31fe77 100644 --- a/btcd.go +++ b/btcd.go @@ -15,10 +15,10 @@ import ( "runtime/debug" "runtime/pprof" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/limits" - "github.com/ltcsuite/ltcd/ossec" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/limits" + "github.com/ltcmweb/ltcd/ossec" ) const ( diff --git a/btcec/README.md b/btcec/README.md index 06c3ab5fb0..c6dacea1b2 100644 --- a/btcec/README.md +++ b/btcec/README.md @@ -20,7 +20,7 @@ use secp256k1 elliptic curve cryptography. ## Installation and Updating ```bash -$ go install -u -v github.com/ltcsuite/ltcd/btcec/v2 +$ go install -u -v github.com/ltcmweb/ltcd/btcec/v2 ``` ## Examples diff --git a/btcec/ecdsa/bench_test.go b/btcec/ecdsa/bench_test.go index 18d9e441a6..2a235ee8fb 100644 --- a/btcec/ecdsa/bench_test.go +++ b/btcec/ecdsa/bench_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) // hexToBytes converts the passed hex string into bytes and will panic if there diff --git a/btcec/ecdsa/example_test.go b/btcec/ecdsa/example_test.go index f29f0684a3..3aaf7fc7b5 100644 --- a/btcec/ecdsa/example_test.go +++ b/btcec/ecdsa/example_test.go @@ -8,9 +8,9 @@ import ( "encoding/hex" "fmt" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // This example demonstrates signing a message with a secp256k1 private key that diff --git a/btcec/ecdsa/signature.go b/btcec/ecdsa/signature.go index 70af3b09e4..a815c7cbb1 100644 --- a/btcec/ecdsa/signature.go +++ b/btcec/ecdsa/signature.go @@ -11,7 +11,7 @@ import ( "math/big" secp_ecdsa "github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) // Errors returned by canonicalPadding. diff --git a/btcec/ecdsa/signature_test.go b/btcec/ecdsa/signature_test.go index 00221592c5..10cf7342dd 100644 --- a/btcec/ecdsa/signature_test.go +++ b/btcec/ecdsa/signature_test.go @@ -14,7 +14,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) type signatureTest struct { diff --git a/btcec/go.mod b/btcec/go.mod index 75d68b9c33..6a4f42be3c 100644 --- a/btcec/go.mod +++ b/btcec/go.mod @@ -1,16 +1,19 @@ -module github.com/ltcsuite/ltcd/btcec/v2 +module github.com/ltcmweb/ltcd/btcec/v2 go 1.17 require ( github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 - github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 - github.com/stretchr/testify v1.8.0 + github.com/ltcmweb/ltcd/chaincfg/chainhash v1.0.3 + github.com/stretchr/testify v1.8.3 ) require ( github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect + github.com/kr/pretty v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/btcec/go.sum b/btcec/go.sum index 6edf64fd4e..4725786513 100644 --- a/btcec/go.sum +++ b/btcec/go.sum @@ -1,3 +1,4 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -5,17 +6,57 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 h1:xuWxvRKxLvOKuS7/Q/7I3tpc3cWAB0+hZpU8YdVqkzg= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2/go.mod h1:nkLkAFGhursWf2U68gt61hPieK1I+0m78e+2aevNyD8= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/ltcmweb/ltcd/chaincfg/chainhash v1.0.3 h1:CAPyzHI3bCFRrrVHZkDUR2i3Awj6l/aqAZIEi0E/nfM= +github.com/ltcmweb/ltcd/chaincfg/chainhash v1.0.3/go.mod h1:zB+HhI2IbIwTGpdAhdzpm1GVX4ShcWTgN42+ar9HXrg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/btcec/schnorr/bench_test.go b/btcec/schnorr/bench_test.go index 7eb1959295..cf386714bd 100644 --- a/btcec/schnorr/bench_test.go +++ b/btcec/schnorr/bench_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) // hexToBytes converts the passed hex string into bytes and will panic if there diff --git a/btcec/schnorr/musig2/bench_test.go b/btcec/schnorr/musig2/bench_test.go index 384f353a8a..6a232d74bf 100644 --- a/btcec/schnorr/musig2/bench_test.go +++ b/btcec/schnorr/musig2/bench_test.go @@ -9,8 +9,8 @@ import ( "fmt" "testing" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" ) var ( diff --git a/btcec/schnorr/musig2/context.go b/btcec/schnorr/musig2/context.go index 911468f73d..c60ae31d67 100644 --- a/btcec/schnorr/musig2/context.go +++ b/btcec/schnorr/musig2/context.go @@ -5,8 +5,8 @@ package musig2 import ( "fmt" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" ) var ( diff --git a/btcec/schnorr/musig2/keys.go b/btcec/schnorr/musig2/keys.go index b43c86327a..a9c77d7de8 100644 --- a/btcec/schnorr/musig2/keys.go +++ b/btcec/schnorr/musig2/keys.go @@ -9,9 +9,9 @@ import ( secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) var ( diff --git a/btcec/schnorr/musig2/keys_test.go b/btcec/schnorr/musig2/keys_test.go index 54c96e2189..923b15b54c 100644 --- a/btcec/schnorr/musig2/keys_test.go +++ b/btcec/schnorr/musig2/keys_test.go @@ -12,8 +12,8 @@ import ( "testing" secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" "github.com/stretchr/testify/require" ) diff --git a/btcec/schnorr/musig2/musig2_test.go b/btcec/schnorr/musig2/musig2_test.go index cbe77ecadc..b2fbc2057d 100644 --- a/btcec/schnorr/musig2/musig2_test.go +++ b/btcec/schnorr/musig2/musig2_test.go @@ -10,7 +10,7 @@ import ( "sync" "testing" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) const ( diff --git a/btcec/schnorr/musig2/nonces.go b/btcec/schnorr/musig2/nonces.go index 7009c5a1db..20d14e41de 100644 --- a/btcec/schnorr/musig2/nonces.go +++ b/btcec/schnorr/musig2/nonces.go @@ -9,9 +9,9 @@ import ( "errors" "io" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( diff --git a/btcec/schnorr/musig2/sign.go b/btcec/schnorr/musig2/sign.go index 4faf1b6b0c..225d4687d4 100644 --- a/btcec/schnorr/musig2/sign.go +++ b/btcec/schnorr/musig2/sign.go @@ -9,9 +9,9 @@ import ( secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) var ( diff --git a/btcec/schnorr/musig2/sign_test.go b/btcec/schnorr/musig2/sign_test.go index acee423d55..4bc4e05963 100644 --- a/btcec/schnorr/musig2/sign_test.go +++ b/btcec/schnorr/musig2/sign_test.go @@ -13,7 +13,7 @@ import ( "testing" secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" "github.com/stretchr/testify/require" ) diff --git a/btcec/schnorr/pubkey.go b/btcec/schnorr/pubkey.go index 4acb0afe6f..d7be69b315 100644 --- a/btcec/schnorr/pubkey.go +++ b/btcec/schnorr/pubkey.go @@ -9,7 +9,7 @@ import ( "fmt" secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) // These constants define the lengths of serialized public keys. diff --git a/btcec/schnorr/signature.go b/btcec/schnorr/signature.go index 44f5c02689..9051c3eb8c 100644 --- a/btcec/schnorr/signature.go +++ b/btcec/schnorr/signature.go @@ -7,8 +7,8 @@ import ( secp "github.com/decred/dcrd/dcrec/secp256k1/v4" ecdsa_schnorr "github.com/decred/dcrd/dcrec/secp256k1/v4/schnorr" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( diff --git a/btcec/schnorr/signature_test.go b/btcec/schnorr/signature_test.go index f4979244dd..9b73e5d683 100644 --- a/btcec/schnorr/signature_test.go +++ b/btcec/schnorr/signature_test.go @@ -15,7 +15,7 @@ import ( "github.com/davecgh/go-spew/spew" secp_ecdsa "github.com/decred/dcrd/dcrec/secp256k1/v4" ecdsa_schnorr "github.com/decred/dcrd/dcrec/secp256k1/v4/schnorr" - "github.com/ltcsuite/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2" ) type bip340Test struct { diff --git a/btcjson/README.md b/btcjson/README.md index 4a6fbacc31..27923f9bcf 100644 --- a/btcjson/README.md +++ b/btcjson/README.md @@ -24,7 +24,7 @@ ints, etc) to higher-level types with many nice and useful properties. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/btcjson +$ go get -u github.com/ltcmweb/ltcd/btcjson ``` ## Examples diff --git a/btcjson/btcdextcmds_test.go b/btcjson/btcdextcmds_test.go index 14303d9b33..191eae764a 100644 --- a/btcjson/btcdextcmds_test.go +++ b/btcjson/btcdextcmds_test.go @@ -12,7 +12,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestBtcdExtCmds tests all of the ltcd extended commands marshal and unmarshal diff --git a/btcjson/btcdextresults_test.go b/btcjson/btcdextresults_test.go index 01a2cb8946..6ea45489e5 100644 --- a/btcjson/btcdextresults_test.go +++ b/btcjson/btcdextresults_test.go @@ -9,7 +9,7 @@ import ( "encoding/json" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestBtcdExtCustomResults ensures any results that have custom marshalling diff --git a/btcjson/btcwalletextcmds_test.go b/btcjson/btcwalletextcmds_test.go index 1dd693c7b2..f37829b977 100644 --- a/btcjson/btcwalletextcmds_test.go +++ b/btcjson/btcwalletextcmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestBtcWalletExtCmds tests all of the ltcwallet extended commands marshal and diff --git a/btcjson/chainsvrcmds.go b/btcjson/chainsvrcmds.go index c1209dd1e5..61313116a6 100644 --- a/btcjson/chainsvrcmds.go +++ b/btcjson/chainsvrcmds.go @@ -13,7 +13,7 @@ import ( "fmt" "reflect" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // AddNodeSubCmd defines the type used in the addnode JSON-RPC command for the diff --git a/btcjson/chainsvrcmds_test.go b/btcjson/chainsvrcmds_test.go index 27257e6b69..e7a895ca2d 100644 --- a/btcjson/chainsvrcmds_test.go +++ b/btcjson/chainsvrcmds_test.go @@ -12,8 +12,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/wire" ) // TestChainSvrCmds tests all of the chain server commands marshal and unmarshal diff --git a/btcjson/chainsvrresults.go b/btcjson/chainsvrresults.go index 3815b1615c..d27aad0f32 100644 --- a/btcjson/chainsvrresults.go +++ b/btcjson/chainsvrresults.go @@ -9,10 +9,10 @@ import ( "encoding/hex" "encoding/json" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // GetBlockHeaderVerboseResult models the data from the getblockheader command when diff --git a/btcjson/chainsvrresults_test.go b/btcjson/chainsvrresults_test.go index 5931868118..6a85f3bfb1 100644 --- a/btcjson/chainsvrresults_test.go +++ b/btcjson/chainsvrresults_test.go @@ -11,9 +11,9 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" ) // TestChainSvrCustomResults ensures any results that have custom marshalling diff --git a/btcjson/chainsvrwscmds_test.go b/btcjson/chainsvrwscmds_test.go index a4e0c6f7b7..4025896ea2 100644 --- a/btcjson/chainsvrwscmds_test.go +++ b/btcjson/chainsvrwscmds_test.go @@ -12,7 +12,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestChainSvrWsCmds tests all of the chain server websocket-specific commands diff --git a/btcjson/chainsvrwsntfns_test.go b/btcjson/chainsvrwsntfns_test.go index 44a9adde38..5087afb09c 100644 --- a/btcjson/chainsvrwsntfns_test.go +++ b/btcjson/chainsvrwsntfns_test.go @@ -12,7 +12,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestChainSvrWsNtfns tests all of the chain server websocket-specific diff --git a/btcjson/chainsvrwsresults_test.go b/btcjson/chainsvrwsresults_test.go index 74eb868198..6400bd09b9 100644 --- a/btcjson/chainsvrwsresults_test.go +++ b/btcjson/chainsvrwsresults_test.go @@ -9,7 +9,7 @@ import ( "encoding/json" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestChainSvrWsResults ensures any results that have custom marshalling diff --git a/btcjson/cmdinfo_test.go b/btcjson/cmdinfo_test.go index 562bc12b7d..fb72ff7ef3 100644 --- a/btcjson/cmdinfo_test.go +++ b/btcjson/cmdinfo_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestCmdMethod tests the CmdMethod function to ensure it retunrs the expected diff --git a/btcjson/cmdparse_test.go b/btcjson/cmdparse_test.go index 3af24d3290..ddaad0484d 100644 --- a/btcjson/cmdparse_test.go +++ b/btcjson/cmdparse_test.go @@ -10,7 +10,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestAssignField tests the assignField function handles supported combinations diff --git a/btcjson/error_test.go b/btcjson/error_test.go index b75f8d03e7..45b1eaee1f 100644 --- a/btcjson/error_test.go +++ b/btcjson/error_test.go @@ -7,7 +7,7 @@ package btcjson_test import ( "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestErrorCodeStringer tests the stringized output for the ErrorCode type. diff --git a/btcjson/example_test.go b/btcjson/example_test.go index 66e9338b1b..58bea984a6 100644 --- a/btcjson/example_test.go +++ b/btcjson/example_test.go @@ -8,7 +8,7 @@ import ( "encoding/json" "fmt" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // This example demonstrates how to create and marshal a command into a JSON-RPC diff --git a/btcjson/help_test.go b/btcjson/help_test.go index 1cd681c17d..32589ba45b 100644 --- a/btcjson/help_test.go +++ b/btcjson/help_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestHelpReflectInternals ensures the various help functions which deal with diff --git a/btcjson/helpers_test.go b/btcjson/helpers_test.go index 8f43774495..530b29ea87 100644 --- a/btcjson/helpers_test.go +++ b/btcjson/helpers_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestHelpers tests the various helper functions which create pointers to diff --git a/btcjson/jsonrpc_test.go b/btcjson/jsonrpc_test.go index d56d783d89..55dc10d603 100644 --- a/btcjson/jsonrpc_test.go +++ b/btcjson/jsonrpc_test.go @@ -9,7 +9,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestIsValidIDType ensures the IsValidIDType function behaves as expected. diff --git a/btcjson/register_test.go b/btcjson/register_test.go index 3c0d449d0a..b6f0650233 100644 --- a/btcjson/register_test.go +++ b/btcjson/register_test.go @@ -9,7 +9,7 @@ import ( "sort" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestUsageFlagStringer tests the stringized output for the UsageFlag type. diff --git a/btcjson/walletsvrcmds.go b/btcjson/walletsvrcmds.go index c1cb9cabc6..26da6b9bf1 100644 --- a/btcjson/walletsvrcmds.go +++ b/btcjson/walletsvrcmds.go @@ -12,7 +12,7 @@ import ( "encoding/json" "fmt" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) // AddMultisigAddressCmd defines the addmutisigaddress JSON-RPC command. diff --git a/btcjson/walletsvrcmds_test.go b/btcjson/walletsvrcmds_test.go index 260f40c2fa..ec81f71d0f 100644 --- a/btcjson/walletsvrcmds_test.go +++ b/btcjson/walletsvrcmds_test.go @@ -11,8 +11,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/ltcutil" ) // TestWalletSvrCmds tests all of the wallet server commands marshal and diff --git a/btcjson/walletsvrresults.go b/btcjson/walletsvrresults.go index ed3edbcaa9..a8af10ac96 100644 --- a/btcjson/walletsvrresults.go +++ b/btcjson/walletsvrresults.go @@ -8,7 +8,7 @@ import ( "encoding/json" "fmt" - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/txscript" ) // CreateWalletResult models the result of the createwallet command. diff --git a/btcjson/walletsvrresults_test.go b/btcjson/walletsvrresults_test.go index 7579633ad4..51c48c0238 100644 --- a/btcjson/walletsvrresults_test.go +++ b/btcjson/walletsvrresults_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/txscript" ) // TestGetAddressInfoResult ensures that custom unmarshalling of diff --git a/btcjson/walletsvrwscmds_test.go b/btcjson/walletsvrwscmds_test.go index 40d5433ef8..836ab2b5d5 100644 --- a/btcjson/walletsvrwscmds_test.go +++ b/btcjson/walletsvrwscmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestWalletSvrWsCmds tests all of the wallet server websocket-specific diff --git a/btcjson/walletsvrwsntfns_test.go b/btcjson/walletsvrwsntfns_test.go index c680b033cf..3c2bc9d921 100644 --- a/btcjson/walletsvrwsntfns_test.go +++ b/btcjson/walletsvrwsntfns_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // TestWalletSvrWsNtfns tests all of the chain server websocket-specific diff --git a/chaincfg/README.md b/chaincfg/README.md index 0571824e48..4f332efeee 100644 --- a/chaincfg/README.md +++ b/chaincfg/README.md @@ -23,8 +23,8 @@ import ( "fmt" "log" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg" ) var testnet = flag.Bool("testnet", false, "operate on the testnet Litecoin network") @@ -55,7 +55,7 @@ func main() { ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/chaincfg +$ go get -u github.com/ltcmweb/ltcd/chaincfg ``` ## GPG Verification Key diff --git a/chaincfg/chainhash/README.md b/chaincfg/chainhash/README.md index 0d459f0327..c9603560d2 100644 --- a/chaincfg/chainhash/README.md +++ b/chaincfg/chainhash/README.md @@ -11,7 +11,7 @@ specific hash algorithm to be abstracted. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/chaincfg/chainhash +$ go get -u github.com/ltcmweb/ltcd/chaincfg/chainhash ``` ## GPG Verification Key diff --git a/chaincfg/chainhash/go.mod b/chaincfg/chainhash/go.mod index c9970e2807..3fb29330a5 100644 --- a/chaincfg/chainhash/go.mod +++ b/chaincfg/chainhash/go.mod @@ -1,3 +1,3 @@ -module github.com/ltcsuite/ltcd/chaincfg/chainhash +module github.com/ltcmweb/ltcd/chaincfg/chainhash go 1.17 diff --git a/chaincfg/deployment_block_height.go b/chaincfg/deployment_block_height.go new file mode 100644 index 0000000000..5549f9e5e4 --- /dev/null +++ b/chaincfg/deployment_block_height.go @@ -0,0 +1,65 @@ +package chaincfg + +import ( + "github.com/ltcmweb/ltcd/wire" +) + +// BlockHeightDeploymentStarter is a ConsensusDeploymentStarter +// that uses block height to determine if a deployment has started. +type BlockHeightDeploymentStarter struct { + startHeight int32 +} + +// NewBlockHeightDeploymentStarter returns a new instance of a +// BlockHeightDeploymentStarter for a given block height. +func NewBlockHeightDeploymentStarter(startHeight int32) *BlockHeightDeploymentStarter { + return &BlockHeightDeploymentStarter{ + startHeight: startHeight, + } +} + +// HasStarted returns true if the consensus deployment has started. +func (b *BlockHeightDeploymentStarter) HasStarted( + blkHeader *wire.BlockHeader, blkHeight int32) (bool, error) { + + return b.startHeight <= blkHeight, nil +} + +// StartHeight returns the raw start block height of the deployment. +func (b *BlockHeightDeploymentStarter) StartHeight() int32 { + return b.startHeight +} + +// A compile-time assertion to ensure BlockHeightDeploymentStarter +// implements the ConsensusDeploymentStarter interface. +var _ ConsensusDeploymentStarter = (*BlockHeightDeploymentStarter)(nil) + +// BlockHeightDeploymentEnder is a ConsensusDeploymentEnder that uses +// block height to determine if a deployment has ended. +type BlockHeightDeploymentEnder struct { + endHeight int32 +} + +// NewBlockHeightDeploymentEnder returns a new instance of the +// BlockHeightDeploymentEnder for a given block height. +func NewBlockHeightDeploymentEnder(endHeight int32) *BlockHeightDeploymentEnder { + return &BlockHeightDeploymentEnder{ + endHeight: endHeight, + } +} + +// HasEnded returns true if the deployment has ended. +func (b *BlockHeightDeploymentEnder) HasEnded( + blkHeader *wire.BlockHeader, blkHeight int32) (bool, error) { + + return b.endHeight <= blkHeight, nil +} + +// EndHeight returns the raw end block height of the deployment. +func (b *BlockHeightDeploymentEnder) EndHeight() int32 { + return b.endHeight +} + +// A compile-time assertion to ensure BlockHeightDeploymentEnder +// implements the ConsensusDeploymentEnder interface. +var _ ConsensusDeploymentEnder = (*BlockHeightDeploymentEnder)(nil) diff --git a/chaincfg/deployment_time_frame.go b/chaincfg/deployment_time_frame.go index b5fef83c30..342cff2651 100644 --- a/chaincfg/deployment_time_frame.go +++ b/chaincfg/deployment_time_frame.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) var ( @@ -31,7 +31,7 @@ type BlockClock interface { // passed. type ConsensusDeploymentStarter interface { // HasStarted returns true if the consensus deployment has started. - HasStarted(*wire.BlockHeader) (bool, error) + HasStarted(*wire.BlockHeader, int32) (bool, error) } // ClockConsensusDeploymentStarter is a more specialized version of the @@ -53,7 +53,7 @@ type ClockConsensusDeploymentStarter interface { // deployment is no longer eligible for activation. type ConsensusDeploymentEnder interface { // HasEnded returns true if the consensus deployment has ended. - HasEnded(*wire.BlockHeader) (bool, error) + HasEnded(*wire.BlockHeader, int32) (bool, error) } // ClockConsensusDeploymentEnder is a more specialized version of the @@ -96,7 +96,9 @@ func (m *MedianTimeDeploymentStarter) SynchronizeClock(clock BlockClock) { } // HasStarted returns true if the consensus deployment has started. -func (m *MedianTimeDeploymentStarter) HasStarted(blkHeader *wire.BlockHeader) (bool, error) { +func (m *MedianTimeDeploymentStarter) HasStarted( + blkHeader *wire.BlockHeader, blkHeight int32) (bool, error) { + switch { // If we haven't yet been synchronized with a block clock, then we // can't tell the time, so we'll fail. @@ -146,7 +148,9 @@ func NewMedianTimeDeploymentEnder(endTime time.Time) *MedianTimeDeploymentEnder } // HasEnded returns true if the deployment has ended. -func (m *MedianTimeDeploymentEnder) HasEnded(blkHeader *wire.BlockHeader) (bool, error) { +func (m *MedianTimeDeploymentEnder) HasEnded( + blkHeader *wire.BlockHeader, blkHeight int32) (bool, error) { + switch { // If we haven't yet been synchronized with a block clock, then we can't tell // the time, so we'll we haven't yet been synchronized with a block diff --git a/chaincfg/doc.go b/chaincfg/doc.go index e81d3c9d7a..d99e0d7823 100644 --- a/chaincfg/doc.go +++ b/chaincfg/doc.go @@ -25,8 +25,8 @@ // "fmt" // "log" // -// "github.com/ltcsuite/ltcd/ltcutil" -// "github.com/ltcsuite/ltcd/chaincfg" +// "github.com/ltcmweb/ltcd/ltcutil" +// "github.com/ltcmweb/ltcd/chaincfg" // ) // // var testnet = flag.Bool("testnet", false, "operate on the testnet Litecoin network") diff --git a/chaincfg/genesis.go b/chaincfg/genesis.go index cd1fce13e2..33eca0f1eb 100644 --- a/chaincfg/genesis.go +++ b/chaincfg/genesis.go @@ -7,8 +7,8 @@ package chaincfg import ( "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // genesisCoinbaseTx is the coinbase transaction for the genesis blocks for diff --git a/chaincfg/params.go b/chaincfg/params.go index b99a587ce5..5bf4c4b59e 100644 --- a/chaincfg/params.go +++ b/chaincfg/params.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // These variables are the chain proof-of-work limit parameters for each default @@ -144,6 +144,11 @@ const ( // the deployment of BIPS 340, 341 and 342. DeploymentTaproot + // DeploymentMweb defines the rule change deployment ID for the + // MWEB soft-fork package. The MWEB package includes the deployment + // of LIPS 2, 3 and 4. + DeploymentMweb + // NOTE: DefinedDeployments must always come last since it is used to // determine how many defined deployments there currently are. @@ -197,6 +202,10 @@ type Params struct { // coins (coinbase transactions) can be spent. CoinbaseMaturity uint16 + // MwebPegoutMaturity is the number of blocks required before coins + // pegged-out from MWEB can be spent. + MwebPegoutMaturity uint16 + // SubsidyReductionInterval is the interval of blocks before the subsidy // is reduced. SubsidyReductionInterval int32 @@ -258,6 +267,9 @@ type Params struct { // in BIP 173. Bech32HRPSegwit string + // Human-readable part for Bech32 encoded mweb addresses. + Bech32HRPMweb string + // Address encoding magics PubKeyHashAddrID byte // First byte of a P2PKH address ScriptHashAddrID byte // First byte of a P2SH address @@ -290,11 +302,12 @@ var MainNetParams = Params{ GenesisBlock: &genesisBlock, GenesisHash: &genesisHash, PowLimit: mainPowLimit, - PowLimitBits: 504365055, + PowLimitBits: 0x1e0ffff0, BIP0034Height: 710000, BIP0065Height: 918684, BIP0066Height: 811879, CoinbaseMaturity: 100, + MwebPegoutMaturity: 6, SubsidyReductionInterval: 840000, TargetTimespan: (time.Hour * 24 * 3) + (time.Hour * 12), // 3.5 days TargetTimePerBlock: (time.Minute * 2) + (time.Second * 30), // 2.5 minutes @@ -371,14 +384,21 @@ var MainNetParams = Params{ }, DeploymentTaproot: { BitNumber: 2, - DeploymentStarter: NewMedianTimeDeploymentStarter( - time.Unix(1619222400, 0), // April 24th, 2021 UTC. + DeploymentStarter: NewBlockHeightDeploymentStarter( + 2161152, // End November 2021 ), - DeploymentEnder: NewMedianTimeDeploymentEnder( - time.Unix(1628640000, 0), // August 11th, 2021 UTC. + DeploymentEnder: NewBlockHeightDeploymentEnder( + 2370816, // 364 days later + ), + }, + DeploymentMweb: { + BitNumber: 4, + DeploymentStarter: NewBlockHeightDeploymentStarter( + 2217600, // End Feb 2022 + ), + DeploymentEnder: NewBlockHeightDeploymentEnder( + 2427264, // 364 days later ), - CustomActivationThreshold: 1815, // 90% - MinActivationHeight: 709_632, }, }, @@ -389,6 +409,9 @@ var MainNetParams = Params{ // BIP 173. Bech32HRPSegwit: "ltc", // always ltc for main net + // Human-readable part for Bech32 encoded mweb addresses. + Bech32HRPMweb: "ltcmweb", // always ltcmweb for main net + // Address encoding magics PubKeyHashAddrID: 0x30, // starts with L ScriptHashAddrID: 0x32, // starts with M @@ -421,6 +444,7 @@ var RegressionNetParams = Params{ PowLimitBits: 0x207fffff, PoWNoRetargeting: true, CoinbaseMaturity: 100, + MwebPegoutMaturity: 6, BIP0034Height: 100000000, // Not active - Permit ver 1 blocks BIP0065Height: 1351, // Used by regression tests BIP0066Height: 1251, // Used by regression tests @@ -488,7 +512,15 @@ var RegressionNetParams = Params{ DeploymentEnder: NewMedianTimeDeploymentEnder( time.Time{}, // Never expires. ), - CustomActivationThreshold: 108, // Only needs 75% hash rate. + }, + DeploymentMweb: { + BitNumber: 4, + DeploymentStarter: NewMedianTimeDeploymentStarter( + time.Unix(1601450001, 0), // September 30, 2020 UTC + ), + DeploymentEnder: NewMedianTimeDeploymentEnder( + time.Time{}, // Never expires. + ), }, }, @@ -499,6 +531,9 @@ var RegressionNetParams = Params{ // BIP 173. Bech32HRPSegwit: "rltc", // always rltc for reg test net + // Human-readable part for Bech32 encoded mweb addresses. + Bech32HRPMweb: "tmweb", // always tmweb for reg test net + // Address encoding magics PubKeyHashAddrID: 0x6f, // starts with m or n ScriptHashAddrID: 0x3a, // starts with Q @@ -530,11 +565,12 @@ var TestNet4Params = Params{ GenesisBlock: &testNet4GenesisBlock, GenesisHash: &testNet4GenesisHash, PowLimit: testNet4PowLimit, - PowLimitBits: 504365055, + PowLimitBits: 0x1e0fffff, BIP0034Height: 76, BIP0065Height: 76, BIP0066Height: 76, CoinbaseMaturity: 100, + MwebPegoutMaturity: 6, SubsidyReductionInterval: 840000, TargetTimespan: (time.Hour * 24 * 3) + (time.Hour * 12), // 3.5 days TargetTimePerBlock: (time.Minute * 2) + (time.Second * 30), // 2.5 minutes @@ -600,13 +636,21 @@ var TestNet4Params = Params{ }, DeploymentTaproot: { BitNumber: 2, - DeploymentStarter: NewMedianTimeDeploymentStarter( - time.Unix(1619222400, 0), // April 24th, 2021 UTC. + DeploymentStarter: NewBlockHeightDeploymentStarter( + 2225664, // March 2022 ), - DeploymentEnder: NewMedianTimeDeploymentEnder( - time.Unix(1628640000, 0), // August 11th, 2021 UTC + DeploymentEnder: NewBlockHeightDeploymentEnder( + 2435328, // 364 days later + ), + }, + DeploymentMweb: { + BitNumber: 4, + DeploymentStarter: NewBlockHeightDeploymentStarter( + 2209536, // Jan/Feb 2022 + ), + DeploymentEnder: NewBlockHeightDeploymentEnder( + 2419200, // 364 days later ), - CustomActivationThreshold: 1512, // 75% }, }, @@ -617,6 +661,9 @@ var TestNet4Params = Params{ // BIP 173. Bech32HRPSegwit: "tltc", // always tltc for test net + // Human-readable part for Bech32 encoded mweb addresses. + Bech32HRPMweb: "tmweb", // always tmweb for test net + // Address encoding magics PubKeyHashAddrID: 0x6f, // starts with m or n ScriptHashAddrID: 0x3a, // starts with Q @@ -655,6 +702,7 @@ var SimNetParams = Params{ BIP0065Height: 0, // Always active on simnet BIP0066Height: 0, // Always active on simnet CoinbaseMaturity: 100, + MwebPegoutMaturity: 6, SubsidyReductionInterval: 210000, TargetTimespan: (time.Hour * 24 * 3) + (time.Hour * 12), // 3.5 days TargetTimePerBlock: (time.Minute * 2) + (time.Second * 30), // 2.5 minutes @@ -783,6 +831,7 @@ func CustomSignetParams(challenge []byte, dnsSeeds []DNSSeed) Params { BIP0065Height: 1, BIP0066Height: 1, CoinbaseMaturity: 100, + MwebPegoutMaturity: 6, SubsidyReductionInterval: 210000, TargetTimespan: (time.Hour * 24 * 3) + (time.Hour * 12), // 3.5 days TargetTimePerBlock: (time.Minute * 2) + (time.Second * 30), // 2.5 minutes @@ -895,6 +944,7 @@ var ( pubKeyHashAddrIDs = make(map[byte]struct{}) scriptHashAddrIDs = make(map[byte]struct{}) bech32SegwitPrefixes = make(map[string]struct{}) + bech32MwebPrefixes = make(map[string]struct{}) hdPrivToPubKeyIDs = make(map[[4]byte][]byte) ) @@ -928,6 +978,11 @@ func Register(params *Params) error { // A valid Bech32 encoded segwit address always has as prefix the // human-readable part for the given net followed by '1'. bech32SegwitPrefixes[params.Bech32HRPSegwit+"1"] = struct{}{} + + // A valid Bech32 encoded MWEB address always has as prefix the + // human-readable part for the given net followed by '1'. + bech32MwebPrefixes[params.Bech32HRPMweb+"1"] = struct{}{} + return nil } @@ -970,6 +1025,15 @@ func IsBech32SegwitPrefix(prefix string) bool { return ok } +// IsBech32MwebPrefix returns whether the prefix is a known prefix for MWEB +// addresses on any default or registered network. This is used when decoding +// an address string into a specific address type. +func IsBech32MwebPrefix(prefix string) bool { + prefix = strings.ToLower(prefix) + _, ok := bech32MwebPrefixes[prefix] + return ok +} + // RegisterHDKeyID registers a public and private hierarchical deterministic // extended key ID pair. // diff --git a/chaincfg/register_test.go b/chaincfg/register_test.go index edac4b0e68..abbfd06a29 100644 --- a/chaincfg/register_test.go +++ b/chaincfg/register_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - . "github.com/ltcsuite/ltcd/chaincfg" + . "github.com/ltcmweb/ltcd/chaincfg" ) // Define some of the required parameters for a user-registered diff --git a/cmd/addblock/addblock.go b/cmd/addblock/addblock.go index 5d731c1dd8..7b0c5224b0 100644 --- a/cmd/addblock/addblock.go +++ b/cmd/addblock/addblock.go @@ -8,10 +8,10 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/limits" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/limits" "github.com/btcsuite/btclog" ) diff --git a/cmd/addblock/config.go b/cmd/addblock/config.go index a4b8ec4666..ac959e16db 100644 --- a/cmd/addblock/config.go +++ b/cmd/addblock/config.go @@ -10,11 +10,11 @@ import ( "path/filepath" flags "github.com/jessevdk/go-flags" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/cmd/addblock/import.go b/cmd/addblock/import.go index 5ad10b8939..0979efb420 100644 --- a/cmd/addblock/import.go +++ b/cmd/addblock/import.go @@ -11,12 +11,12 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) var zeroHash = chainhash.Hash{} diff --git a/cmd/findcheckpoint/config.go b/cmd/findcheckpoint/config.go index 6c3046b6a5..f4cf8d82af 100644 --- a/cmd/findcheckpoint/config.go +++ b/cmd/findcheckpoint/config.go @@ -10,11 +10,11 @@ import ( "path/filepath" flags "github.com/jessevdk/go-flags" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/cmd/findcheckpoint/findcheckpoint.go b/cmd/findcheckpoint/findcheckpoint.go index 88f422df7a..2f1e69d610 100644 --- a/cmd/findcheckpoint/findcheckpoint.go +++ b/cmd/findcheckpoint/findcheckpoint.go @@ -9,10 +9,10 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" ) const blockDbNamePrefix = "blocks" diff --git a/cmd/gencerts/gencerts.go b/cmd/gencerts/gencerts.go index c99aa0b6f0..eb7adb56eb 100644 --- a/cmd/gencerts/gencerts.go +++ b/cmd/gencerts/gencerts.go @@ -13,7 +13,7 @@ import ( "time" flags "github.com/jessevdk/go-flags" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) type config struct { diff --git a/cmd/ltcctl/config.go b/cmd/ltcctl/config.go index cf93d558d3..24eab12790 100644 --- a/cmd/ltcctl/config.go +++ b/cmd/ltcctl/config.go @@ -14,9 +14,9 @@ import ( "strings" flags "github.com/jessevdk/go-flags" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" ) const ( diff --git a/cmd/ltcctl/httpclient.go b/cmd/ltcctl/httpclient.go index 6c452c0178..f9e699249f 100644 --- a/cmd/ltcctl/httpclient.go +++ b/cmd/ltcctl/httpclient.go @@ -10,7 +10,7 @@ import ( "net" "net/http" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" "github.com/btcsuite/go-socks/socks" ) diff --git a/cmd/ltcctl/ltcctl.go b/cmd/ltcctl/ltcctl.go index b8d9aa6dd6..0e0f565b75 100644 --- a/cmd/ltcctl/ltcctl.go +++ b/cmd/ltcctl/ltcctl.go @@ -10,7 +10,7 @@ import ( "path/filepath" "strings" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) const ( diff --git a/config.go b/config.go index 72a2ddc2ca..5579d540eb 100644 --- a/config.go +++ b/config.go @@ -23,16 +23,16 @@ import ( "github.com/btcsuite/go-socks/socks" flags "github.com/jessevdk/go-flags" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/connmgr" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mempool" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/connmgr" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mempool" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/connmgr/README.md b/connmgr/README.md index 4856d9f78c..8ddbbb2fb9 100644 --- a/connmgr/README.md +++ b/connmgr/README.md @@ -29,7 +29,7 @@ In addition the connection manager provides the following utilities: ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/connmgr +$ go get -u github.com/ltcmweb/ltcd/connmgr ``` ## License diff --git a/connmgr/seed.go b/connmgr/seed.go index 4493ef4489..9625947c0d 100644 --- a/connmgr/seed.go +++ b/connmgr/seed.go @@ -11,8 +11,8 @@ import ( "strconv" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/database/README.md b/database/README.md index 349553e03d..d6ea3c71dc 100644 --- a/database/README.md +++ b/database/README.md @@ -37,7 +37,7 @@ storage, and strict checksums in key areas to ensure data integrity. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/database +$ go get -u github.com/ltcmweb/ltcd/database ``` ## Examples diff --git a/database/cmd/dbtool/fetchblock.go b/database/cmd/dbtool/fetchblock.go index 2b29c2a225..3509a33beb 100644 --- a/database/cmd/dbtool/fetchblock.go +++ b/database/cmd/dbtool/fetchblock.go @@ -9,8 +9,8 @@ import ( "errors" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" ) // fetchBlockCmd defines the configuration options for the fetchblock command. diff --git a/database/cmd/dbtool/fetchblockregion.go b/database/cmd/dbtool/fetchblockregion.go index 9cd03e6174..dd25d6c8b7 100644 --- a/database/cmd/dbtool/fetchblockregion.go +++ b/database/cmd/dbtool/fetchblockregion.go @@ -10,8 +10,8 @@ import ( "strconv" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" ) // blockRegionCmd defines the configuration options for the fetchblockregion diff --git a/database/cmd/dbtool/globalconfig.go b/database/cmd/dbtool/globalconfig.go index 6fda9c5223..724227268a 100644 --- a/database/cmd/dbtool/globalconfig.go +++ b/database/cmd/dbtool/globalconfig.go @@ -10,11 +10,11 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/database/cmd/dbtool/insecureimport.go b/database/cmd/dbtool/insecureimport.go index 52bf5339c0..0d13d4b5e9 100644 --- a/database/cmd/dbtool/insecureimport.go +++ b/database/cmd/dbtool/insecureimport.go @@ -12,10 +12,10 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // importCmd defines the configuration options for the insecureimport command. diff --git a/database/cmd/dbtool/loadheaders.go b/database/cmd/dbtool/loadheaders.go index 715de70dc3..b9a7da3017 100644 --- a/database/cmd/dbtool/loadheaders.go +++ b/database/cmd/dbtool/loadheaders.go @@ -7,8 +7,8 @@ package main import ( "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" ) // headersCmd defines the configuration options for the loadheaders command. diff --git a/database/cmd/dbtool/main.go b/database/cmd/dbtool/main.go index e47a96d978..999141bd99 100644 --- a/database/cmd/dbtool/main.go +++ b/database/cmd/dbtool/main.go @@ -9,9 +9,9 @@ import ( "path/filepath" "strings" - "github.com/ltcsuite/ltcd/database" "github.com/btcsuite/btclog" flags "github.com/jessevdk/go-flags" + "github.com/ltcmweb/ltcd/database" ) const ( diff --git a/database/driver_test.go b/database/driver_test.go index 394602e894..132da500ed 100644 --- a/database/driver_test.go +++ b/database/driver_test.go @@ -8,8 +8,8 @@ import ( "fmt" "testing" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" ) var ( diff --git a/database/error_test.go b/database/error_test.go index 217f7f3b26..1a5947684d 100644 --- a/database/error_test.go +++ b/database/error_test.go @@ -8,7 +8,7 @@ import ( "errors" "testing" - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/database" ) // TestErrorCodeStringer tests the stringized output for the ErrorCode type. diff --git a/database/example_test.go b/database/example_test.go index 2ef2ce71e9..a353b7aef4 100644 --- a/database/example_test.go +++ b/database/example_test.go @@ -11,11 +11,11 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - _ "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + _ "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // This example demonstrates creating a new database. @@ -23,8 +23,8 @@ func ExampleCreate() { // This example assumes the ffldb driver is imported. // // import ( - // "github.com/ltcsuite/ltcd/database" - // _ "github.com/ltcsuite/ltcd/database/ffldb" + // "github.com/ltcmweb/ltcd/database" + // _ "github.com/ltcmweb/ltcd/database/ffldb" // ) // Create a database and schedule it to be closed and removed on exit. @@ -49,8 +49,8 @@ func Example_basicUsage() { // This example assumes the ffldb driver is imported. // // import ( - // "github.com/ltcsuite/ltcd/database" - // _ "github.com/ltcsuite/ltcd/database/ffldb" + // "github.com/ltcmweb/ltcd/database" + // _ "github.com/ltcmweb/ltcd/database/ffldb" // ) // Create a database and schedule it to be closed and removed on exit. @@ -115,8 +115,8 @@ func Example_blockStorageAndRetrieval() { // This example assumes the ffldb driver is imported. // // import ( - // "github.com/ltcsuite/ltcd/database" - // _ "github.com/ltcsuite/ltcd/database/ffldb" + // "github.com/ltcmweb/ltcd/database" + // _ "github.com/ltcmweb/ltcd/database/ffldb" // ) // Create a database and schedule it to be closed and removed on exit. diff --git a/database/ffldb/bench_test.go b/database/ffldb/bench_test.go index 381c29fdde..d05f078b9b 100644 --- a/database/ffldb/bench_test.go +++ b/database/ffldb/bench_test.go @@ -9,9 +9,9 @@ import ( "path/filepath" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" ) // BenchmarkBlockHeader benchmarks how long it takes to load the mainnet genesis diff --git a/database/ffldb/blockio.go b/database/ffldb/blockio.go index fd5ef856ed..409326e5c3 100644 --- a/database/ffldb/blockio.go +++ b/database/ffldb/blockio.go @@ -20,9 +20,9 @@ import ( "strings" "sync" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/database/ffldb/db.go b/database/ffldb/db.go index 20a00c9c6e..812a804db4 100644 --- a/database/ffldb/db.go +++ b/database/ffldb/db.go @@ -14,11 +14,11 @@ import ( "sort" "sync" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/database/internal/treap" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/database/internal/treap" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/comparer" ldberrors "github.com/syndtr/goleveldb/leveldb/errors" diff --git a/database/ffldb/dbcache.go b/database/ffldb/dbcache.go index e638eaf034..a26f4e1357 100644 --- a/database/ffldb/dbcache.go +++ b/database/ffldb/dbcache.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/database/internal/treap" + "github.com/ltcmweb/ltcd/database/internal/treap" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/iterator" "github.com/syndtr/goleveldb/leveldb/util" diff --git a/database/ffldb/driver.go b/database/ffldb/driver.go index 0c8e63271c..46a6c3a48d 100644 --- a/database/ffldb/driver.go +++ b/database/ffldb/driver.go @@ -7,9 +7,9 @@ package ffldb import ( "fmt" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/wire" "github.com/btcsuite/btclog" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/wire" ) var log = btclog.Disabled diff --git a/database/ffldb/driver_test.go b/database/ffldb/driver_test.go index 3daf89f1a2..43de57f53f 100644 --- a/database/ffldb/driver_test.go +++ b/database/ffldb/driver_test.go @@ -12,11 +12,11 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/database/ffldb" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/database/ffldb" + "github.com/ltcmweb/ltcd/ltcutil" ) // dbType is the database type name for this driver. diff --git a/database/ffldb/export_test.go b/database/ffldb/export_test.go index 9236dcafd0..6acd6c2e4c 100644 --- a/database/ffldb/export_test.go +++ b/database/ffldb/export_test.go @@ -12,7 +12,7 @@ The functions are only exported while the tests are being run. package ffldb import ( - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/database" ) // TstRunWithMaxBlockFileSize runs the passed function with the maximum allowed diff --git a/database/ffldb/interface_test.go b/database/ffldb/interface_test.go index 6aec7ce142..e240f38104 100644 --- a/database/ffldb/interface_test.go +++ b/database/ffldb/interface_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/database/ffldb/ldbtreapiter.go b/database/ffldb/ldbtreapiter.go index 46516d2816..a91fe09206 100644 --- a/database/ffldb/ldbtreapiter.go +++ b/database/ffldb/ldbtreapiter.go @@ -5,7 +5,7 @@ package ffldb import ( - "github.com/ltcsuite/ltcd/database/internal/treap" + "github.com/ltcmweb/ltcd/database/internal/treap" "github.com/syndtr/goleveldb/leveldb/iterator" "github.com/syndtr/goleveldb/leveldb/util" ) diff --git a/database/ffldb/reconcile.go b/database/ffldb/reconcile.go index 6eef0d508e..f5ce98bcba 100644 --- a/database/ffldb/reconcile.go +++ b/database/ffldb/reconcile.go @@ -8,7 +8,7 @@ import ( "fmt" "hash/crc32" - "github.com/ltcsuite/ltcd/database" + "github.com/ltcmweb/ltcd/database" ) // The serialized write cursor location format is: diff --git a/database/ffldb/whitebox_test.go b/database/ffldb/whitebox_test.go index cba0d0bb01..7ca55acf9d 100644 --- a/database/ffldb/whitebox_test.go +++ b/database/ffldb/whitebox_test.go @@ -17,10 +17,10 @@ import ( "path/filepath" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" "github.com/syndtr/goleveldb/leveldb" ldberrors "github.com/syndtr/goleveldb/leveldb/errors" ) diff --git a/database/interface.go b/database/interface.go index 9b29247328..8a6d66afa2 100644 --- a/database/interface.go +++ b/database/interface.go @@ -8,8 +8,8 @@ package database import ( - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" ) // Cursor represents a cursor over key/value pairs and nested buckets of a diff --git a/docs/json_rpc_api.md b/docs/json_rpc_api.md index 8991844246..5fe0f0f397 100644 --- a/docs/json_rpc_api.md +++ b/docs/json_rpc_api.md @@ -1184,8 +1184,8 @@ import ( "log" "path/filepath" - "github.com/ltcsuite/ltcd/rpcclient" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/ltcutil" ) func main() { @@ -1247,9 +1247,9 @@ import ( "path/filepath" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/rpcclient" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/ltcutil" ) func main() { @@ -1339,9 +1339,9 @@ import ( "path/filepath" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/rpcclient" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/ltcutil" ) func main() { diff --git a/go.mod b/go.mod index a30100b180..38ae319cd3 100644 --- a/go.mod +++ b/go.mod @@ -1,35 +1,40 @@ -module github.com/ltcsuite/ltcd +module github.com/ltcmweb/ltcd require ( + github.com/aead/siphash v1.0.1 github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 github.com/btcsuite/winsvc v1.0.0 github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 - github.com/decred/dcrd/lru v1.0.0 - github.com/jessevdk/go-flags v1.4.0 + github.com/decred/dcrd/lru v1.1.1 + github.com/jessevdk/go-flags v1.5.0 github.com/jrick/logrotate v1.0.0 - github.com/ltcsuite/ltcd/btcec/v2 v2.3.2 - github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 - github.com/ltcsuite/ltcd/ltcutil v1.1.3 - github.com/stretchr/testify v1.8.0 + github.com/kkdai/bstream v1.0.0 + github.com/ltcmweb/ltcd/btcec/v2 v2.3.3 + github.com/ltcmweb/ltcd/chaincfg/chainhash v1.0.3 + github.com/ltcmweb/secp256k1 v0.1.1 + github.com/stretchr/testify v1.8.3 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a - golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 + golang.org/x/crypto v0.7.0 + golang.org/x/sys v0.13.0 gotest.tools v2.2.0+incompatible lukechampine.com/blake3 v1.2.1 ) require ( - github.com/aead/siphash v1.0.1 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/go-cmp v0.4.0 // indirect - github.com/kkdai/bstream v1.0.0 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/onsi/ginkgo v1.16.4 // indirect + github.com/onsi/gomega v1.26.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 345b308a28..d2a75d0f6b 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,10 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3 github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -15,11 +19,14 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/decred/dcrd/lru v1.1.1 h1:kWFDaW0OWx6AD6Ki342c+JPmHbiVdE6rK81pT3fuo/Y= +github.com/decred/dcrd/lru v1.1.1/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -27,78 +34,192 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kkdai/bstream v1.0.0 h1:Se5gHwgp2VT2uHfDrkbbgbgEvV9cimLELwrPJctSjg8= github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/ltcsuite/ltcd v0.23.5/go.mod h1:JV6swXR5m0cYFi0VYdQPp3UnMdaDQxaRUCaU1PPjb+g= -github.com/ltcsuite/ltcd/btcec/v2 v2.3.2 h1:HVArUNQGqGaSSoyYkk9qGht74U0/uNhS0n7jV9rkmno= -github.com/ltcsuite/ltcd/btcec/v2 v2.3.2/go.mod h1:T1t5TjbjPnryvlGQ+RpSKGuU8KhjNN7rS5+IznPj1VM= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 h1:xuWxvRKxLvOKuS7/Q/7I3tpc3cWAB0+hZpU8YdVqkzg= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2/go.mod h1:nkLkAFGhursWf2U68gt61hPieK1I+0m78e+2aevNyD8= -github.com/ltcsuite/ltcd/ltcutil v1.1.3 h1:8AapjCPLIt/wtYe6Odfk1EC2y9mcbpgjyxyCoNjAkFI= -github.com/ltcsuite/ltcd/ltcutil v1.1.3/go.mod h1:z8txd/ohBFrOMBUT70K8iZvHJD/Vc3gzx+6BP6cBxQw= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/ltcmweb/ltcd/btcec/v2 v2.3.3 h1:gJc1ljDPCBtwBKFcC4SW44BFoJqoZzkeagndMYdqKKE= +github.com/ltcmweb/ltcd/btcec/v2 v2.3.3/go.mod h1:NRr2WtpiSiSO29TkdZhbGNRA/Q16DV2eNbORf+M2ykI= +github.com/ltcmweb/ltcd/chaincfg/chainhash v1.0.3 h1:CAPyzHI3bCFRrrVHZkDUR2i3Awj6l/aqAZIEi0E/nfM= +github.com/ltcmweb/ltcd/chaincfg/chainhash v1.0.3/go.mod h1:zB+HhI2IbIwTGpdAhdzpm1GVX4ShcWTgN42+ar9HXrg= +github.com/ltcmweb/secp256k1 v0.1.1 h1:hsGpnFcZ5zmjSxg7AswZp8ygo5NiY06OYWJk97hFizI= +github.com/ltcmweb/secp256k1 v0.1.1/go.mod h1:Kdj2WHIAc0Y1apPtVY7nVxImRWiRTQue2vs1gt1VoEc= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= +github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= +github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= +github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= +github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= +github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= +github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= +github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -106,14 +227,21 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/integration/bip0009_test.go b/integration/bip0009_test.go index 80e5aa4315..af7c8375de 100644 --- a/integration/bip0009_test.go +++ b/integration/bip0009_test.go @@ -14,10 +14,10 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/integration/rpctest" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/integration/rpctest" ) const ( diff --git a/integration/csv_fork_test.go b/integration/csv_fork_test.go index 7a1d6eacee..a9c784521b 100644 --- a/integration/csv_fork_test.go +++ b/integration/csv_fork_test.go @@ -15,14 +15,14 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/integration/rpctest" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/integration/rpctest" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/integration/rpcserver_test.go b/integration/rpcserver_test.go index 46d2c20c92..f22cbb808e 100644 --- a/integration/rpcserver_test.go +++ b/integration/rpcserver_test.go @@ -16,11 +16,11 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/integration/rpctest" - "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/integration/rpctest" + "github.com/ltcmweb/ltcd/rpcclient" ) func testGetBestBlock(r *rpctest.Harness, t *testing.T) { diff --git a/integration/rpctest/README.md b/integration/rpctest/README.md index a6caf432f5..71804f9cc5 100644 --- a/integration/rpctest/README.md +++ b/integration/rpctest/README.md @@ -20,7 +20,7 @@ systems/integration tests. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/integration/rpctest +$ go get -u github.com/ltcmweb/ltcd/integration/rpctest ``` ## License @@ -53,7 +53,7 @@ systems/integration tests. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/rpctest +$ go get -u github.com/ltcmweb/ltcd/rpctest ``` ## License diff --git a/integration/rpctest/blockgen.go b/integration/rpctest/blockgen.go index 35d4e05824..dc3954bc13 100644 --- a/integration/rpctest/blockgen.go +++ b/integration/rpctest/blockgen.go @@ -11,13 +11,13 @@ import ( "runtime" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // solveBlock attempts to find a nonce which makes the passed block header hash diff --git a/integration/rpctest/btcd.go b/integration/rpctest/btcd.go index 93d35d0da6..1fe06b70ea 100644 --- a/integration/rpctest/btcd.go +++ b/integration/rpctest/btcd.go @@ -49,7 +49,7 @@ func btcdExecutablePath() (string, error) { outputPath += ".exe" } cmd := exec.Command( - "go", "build", "-o", outputPath, "github.com/ltcsuite/ltcd", + "go", "build", "-o", outputPath, "github.com/ltcmweb/ltcd", ) err = cmd.Run() if err != nil { diff --git a/integration/rpctest/memwallet.go b/integration/rpctest/memwallet.go index bfc87cea02..96ea9329ad 100644 --- a/integration/rpctest/memwallet.go +++ b/integration/rpctest/memwallet.go @@ -10,15 +10,15 @@ import ( "fmt" "sync" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/hdkeychain" - "github.com/ltcsuite/ltcd/rpcclient" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/hdkeychain" + "github.com/ltcmweb/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/integration/rpctest/node.go b/integration/rpctest/node.go index 920361d7e4..43e1a1ddf1 100644 --- a/integration/rpctest/node.go +++ b/integration/rpctest/node.go @@ -14,8 +14,8 @@ import ( "runtime" "time" - "github.com/ltcsuite/ltcd/ltcutil" - rpc "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/ltcutil" + rpc "github.com/ltcmweb/ltcd/rpcclient" ) // nodeConfig contains all the args, and data required to launch a ltcd process diff --git a/integration/rpctest/rpc_harness.go b/integration/rpctest/rpc_harness.go index 5beb71dbde..39a6a5da93 100644 --- a/integration/rpctest/rpc_harness.go +++ b/integration/rpctest/rpc_harness.go @@ -16,11 +16,11 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/rpcclient" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/integration/rpctest/rpc_harness_test.go b/integration/rpctest/rpc_harness_test.go index 1cbc424f57..608398eb59 100644 --- a/integration/rpctest/rpc_harness_test.go +++ b/integration/rpctest/rpc_harness_test.go @@ -14,11 +14,11 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) func testSendOutputs(r *Harness, t *testing.T) { diff --git a/integration/rpctest/utils.go b/integration/rpctest/utils.go index 0b81a6a037..64e63098cf 100644 --- a/integration/rpctest/utils.go +++ b/integration/rpctest/utils.go @@ -8,8 +8,8 @@ import ( "reflect" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/rpcclient" ) // JoinType is an enum representing a particular type of "node join". A node diff --git a/log.go b/log.go index 8180c103fe..7308e6c188 100644 --- a/log.go +++ b/log.go @@ -10,17 +10,17 @@ import ( "os" "path/filepath" - "github.com/ltcsuite/ltcd/addrmgr" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/connmgr" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/mempool" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/mining/cpuminer" - "github.com/ltcsuite/ltcd/netsync" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/addrmgr" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/connmgr" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/mempool" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/mining/cpuminer" + "github.com/ltcmweb/ltcd/netsync" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/txscript" "github.com/btcsuite/btclog" "github.com/jrick/logrotate/rotator" diff --git a/ltcutil/README.md b/ltcutil/README.md index 670fbca074..f559a8ddd3 100644 --- a/ltcutil/README.md +++ b/ltcutil/README.md @@ -19,7 +19,7 @@ provided. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil +$ go get -u github.com/ltcmweb/ltcd/ltcutil ``` ## GPG Verification Key diff --git a/ltcutil/address.go b/ltcutil/address.go index 65dc41b8f0..404570d88a 100644 --- a/ltcutil/address.go +++ b/ltcutil/address.go @@ -11,10 +11,11 @@ import ( "fmt" "strings" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil/base58" - "github.com/ltcsuite/ltcd/ltcutil/bech32" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/ltcutil/bech32" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" "golang.org/x/crypto/ripemd160" ) @@ -82,7 +83,7 @@ func encodeSegWitAddress(hrp string, witnessVersion byte, witnessProgram []byte) var bech string switch witnessVersion { - case 0: + case 0, 8, 9: bech, err = bech32.Encode(hrp, combined) case 1: @@ -184,6 +185,12 @@ func DecodeAddress(addr string, defaultNet *chaincfg.Params) (Address, error) { return nil, UnsupportedWitnessProgLenError(len(witnessProg)) } } + } else if chaincfg.IsBech32MwebPrefix(prefix) { + sa, err := decodeMwebAddress(addr) + if err == nil { + hrp := prefix[:len(prefix)-1] + return newAddressMweb(hrp, sa), nil + } } } @@ -280,6 +287,46 @@ func decodeSegWitAddress(address string) (byte, []byte, error) { return version, regrouped, nil } +// decodeMwebAddress parses a bech32 encoded MWEB address string and +// returns the stealth address representation. +func decodeMwebAddress(address string) (*mw.StealthAddress, error) { + // Decode the bech32 encoded address. + _, data, err := bech32.Decode(address) + if err != nil { + return nil, err + } + + // The first byte of the decoded address is the version byte, it must + // exist. + if len(data) < 1 { + return nil, fmt.Errorf("no version byte") + } + + // ...and be == 0. + version := data[0] + if version != 0 { + return nil, fmt.Errorf("invalid version byte: %v", version) + } + + // The remaining characters of the address returned are grouped into + // words of 5 bits. In order to restore the original bytes, we'll + // need to regroup into 8 bit words. + regrouped, err := bech32.ConvertBits(data[1:], 5, 8, false) + if err != nil { + return nil, err + } + + // Address MUST be exactly 66 bytes. + if len(regrouped) != 66 { + return nil, fmt.Errorf("invalid data length") + } + + return &mw.StealthAddress{ + Scan: (*mw.PublicKey)(regrouped[:33]), + Spend: (*mw.PublicKey)(regrouped[33:]), + }, nil +} + // AddressPubKeyHash is an Address for a pay-to-pubkey-hash (P2PKH) // transaction. type AddressPubKeyHash struct { @@ -711,3 +758,103 @@ func newAddressTaproot(hrp string, return addr, nil } + +// AddressWitnessMweb is an Address for a MWEB witness output. +type AddressWitnessMweb struct { + AddressSegWit +} + +// NewAddressWitnessMweb returns a new AddressWitnessMweb. +func NewAddressWitnessMweb(witnessVersion byte, witnessProg []byte, + net *chaincfg.Params) (*AddressWitnessMweb, error) { + + return newAddressWitnessMweb(net.Bech32HRPSegwit, + witnessVersion, witnessProg) +} + +// newAddressWitnessMweb is an internal helper function to create an +// AddressWitnessMweb with a known human-readable part, rather than +// looking it up through its parameters. +func newAddressWitnessMweb(hrp string, witnessVersion byte, + witnessProg []byte) (*AddressWitnessMweb, error) { + + // Check for valid program length, which is 32 for MWEB. + if len(witnessProg) != 32 { + return nil, errors.New("witness program must be 32 " + + "bytes for mweb") + } + + addr := &AddressWitnessMweb{ + AddressSegWit{ + hrp: strings.ToLower(hrp), + witnessVersion: witnessVersion, + witnessProgram: witnessProg, + }, + } + + return addr, nil +} + +// AddressMweb is an Address for an MWEB output. +type AddressMweb struct { + hrp string + sa *mw.StealthAddress +} + +// NewAddressMweb returns a new AddressMweb. +func NewAddressMweb(sa *mw.StealthAddress, net *chaincfg.Params) *AddressMweb { + return newAddressMweb(net.Bech32HRPMweb, sa) +} + +func newAddressMweb(hrp string, sa *mw.StealthAddress) *AddressMweb { + return &AddressMweb{ + hrp: strings.ToLower(hrp), + sa: sa, + } +} + +// EncodeAddress returns the bech32 string encoding of an AddressMweb. +// +// NOTE: This method is part of the Address interface. +func (a *AddressMweb) EncodeAddress() string { + converted, err := bech32.ConvertBits(a.ScriptAddress(), 8, 5, true) + if err != nil { + return "" + } + bech, _ := bech32.Encode(a.hrp, append([]byte{0}, converted...)) + return bech +} + +// ScriptAddress returns the witness program for this address. +// +// NOTE: This method is part of the Address interface. +func (a *AddressMweb) ScriptAddress() []byte { + return append(a.sa.Scan[:], a.sa.Spend[:]...) +} + +// IsForNet returns whether the AddressMweb is associated with the passed +// litecoin network. +// +// NOTE: This method is part of the Address interface. +func (a *AddressMweb) IsForNet(net *chaincfg.Params) bool { + return a.hrp == net.Bech32HRPMweb +} + +// String returns a human-readable string for the AddressMweb. +// This is equivalent to calling EncodeAddress, but is provided so the type +// can be used as a fmt.Stringer. +// +// NOTE: This method is part of the Address interface. +func (a *AddressMweb) String() string { + return a.EncodeAddress() +} + +// Hrp returns the human-readable part of the bech32 encoded AddressMweb. +func (a *AddressMweb) Hrp() string { + return a.hrp +} + +// StealthAddress returns the stealth address. +func (a *AddressMweb) StealthAddress() *mw.StealthAddress { + return a.sa +} diff --git a/ltcutil/address_test.go b/ltcutil/address_test.go index 94b7f0cdae..de2e39dbcf 100644 --- a/ltcutil/address_test.go +++ b/ltcutil/address_test.go @@ -12,8 +12,8 @@ import ( "strings" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" "golang.org/x/crypto/ripemd160" ) diff --git a/ltcutil/amount_test.go b/ltcutil/amount_test.go index 12f45fb92c..d361c56c93 100644 --- a/ltcutil/amount_test.go +++ b/ltcutil/amount_test.go @@ -8,7 +8,7 @@ import ( "math" "testing" - . "github.com/ltcsuite/ltcd/ltcutil" + . "github.com/ltcmweb/ltcd/ltcutil" ) func TestAmountCreation(t *testing.T) { diff --git a/ltcutil/appdata_test.go b/ltcutil/appdata_test.go index 7b5b185388..15376da2f6 100644 --- a/ltcutil/appdata_test.go +++ b/ltcutil/appdata_test.go @@ -12,7 +12,7 @@ import ( "testing" "unicode" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) // TestAppDataDir tests the API for AppDataDir to ensure it gives expected diff --git a/ltcutil/base58/README.md b/ltcutil/base58/README.md index dfb9b026dd..888a59fc55 100644 --- a/ltcutil/base58/README.md +++ b/ltcutil/base58/README.md @@ -14,7 +14,7 @@ A comprehensive suite of tests is provided to ensure proper functionality. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/base58 +$ go get -u github.com/ltcmweb/ltcd/ltcutil/base58 ``` ## Examples diff --git a/ltcutil/base58/base58_test.go b/ltcutil/base58/base58_test.go index 3918f45a1b..b36e730f5d 100644 --- a/ltcutil/base58/base58_test.go +++ b/ltcutil/base58/base58_test.go @@ -9,7 +9,7 @@ import ( "encoding/hex" "testing" - "github.com/ltcsuite/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/ltcutil/base58" ) var stringTests = []struct { diff --git a/ltcutil/base58/base58bench_test.go b/ltcutil/base58/base58bench_test.go index a55be87e90..fa27ec7722 100644 --- a/ltcutil/base58/base58bench_test.go +++ b/ltcutil/base58/base58bench_test.go @@ -8,7 +8,7 @@ import ( "bytes" "testing" - "github.com/ltcsuite/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/ltcutil/base58" ) var ( diff --git a/ltcutil/base58/base58check_test.go b/ltcutil/base58/base58check_test.go index 83d0831c07..605da1d749 100644 --- a/ltcutil/base58/base58check_test.go +++ b/ltcutil/base58/base58check_test.go @@ -7,7 +7,7 @@ package base58_test import ( "testing" - "github.com/ltcsuite/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/ltcutil/base58" ) var checkEncodingStringTests = []struct { diff --git a/ltcutil/base58/example_test.go b/ltcutil/base58/example_test.go index 956136bd3a..a05fc58421 100644 --- a/ltcutil/base58/example_test.go +++ b/ltcutil/base58/example_test.go @@ -7,7 +7,7 @@ package base58_test import ( "fmt" - "github.com/ltcsuite/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/ltcutil/base58" ) // This example demonstrates how to decode modified base58 encoded data. diff --git a/ltcutil/bech32/README.md b/ltcutil/bech32/README.md index c64b789cd9..1cee9bdf97 100644 --- a/ltcutil/bech32/README.md +++ b/ltcutil/bech32/README.md @@ -13,7 +13,7 @@ Test vectors from BIP 173 are added to ensure compatibility with the BIP. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/bech32 +$ go get -u github.com/ltcmweb/ltcd/ltcutil/bech32 ``` ## Examples diff --git a/ltcutil/bech32/bech32.go b/ltcutil/bech32/bech32.go index c1e00106e6..85496d2e6c 100644 --- a/ltcutil/bech32/bech32.go +++ b/ltcutil/bech32/bech32.go @@ -272,8 +272,8 @@ func DecodeNoLimit(bech string) (string, []byte, error) { // Note that the returned data is 5-bit (base32) encoded and the human-readable // part will be lowercase. func Decode(bech string) (string, []byte, error) { - // The maximum allowed length for a bech32 string is 90. - if len(bech) > 90 { + // The maximum allowed length for a bech32 string is 130. + if len(bech) > 130 { return "", nil, ErrInvalidLength(len(bech)) } @@ -286,8 +286,8 @@ func Decode(bech string) (string, []byte, error) { // be used when decoding segwit addresses, as it enables additional // verification to ensure the proper checksum is used. func DecodeGeneric(bech string) (string, []byte, Version, error) { - // The maximum allowed length for a bech32 string is 90. - if len(bech) > 90 { + // The maximum allowed length for a bech32 string is 130. + if len(bech) > 130 { return "", nil, VersionUnknown, ErrInvalidLength(len(bech)) } diff --git a/ltcutil/bech32/example_test.go b/ltcutil/bech32/example_test.go index 980d1af194..8dac7e419e 100644 --- a/ltcutil/bech32/example_test.go +++ b/ltcutil/bech32/example_test.go @@ -8,7 +8,7 @@ import ( "encoding/hex" "fmt" - "github.com/ltcsuite/ltcd/ltcutil/bech32" + "github.com/ltcmweb/ltcd/ltcutil/bech32" ) // This example demonstrates how to decode a bech32 encoded string. diff --git a/ltcutil/block.go b/ltcutil/block.go index e83ede49f9..22bcecb7a7 100644 --- a/ltcutil/block.go +++ b/ltcutil/block.go @@ -9,8 +9,8 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // OutOfRangeError describes an error due to accessing an element that is out diff --git a/ltcutil/block_test.go b/ltcutil/block_test.go index 1d69704a03..b81c388247 100644 --- a/ltcutil/block_test.go +++ b/ltcutil/block_test.go @@ -12,9 +12,9 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // TestBlock tests the API for Block. diff --git a/ltcutil/bloom/README.md b/ltcutil/bloom/README.md index a92159299f..21551b638b 100644 --- a/ltcutil/bloom/README.md +++ b/ltcutil/bloom/README.md @@ -14,7 +14,7 @@ report. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/bloom +$ go get -u github.com/ltcmweb/ltcd/ltcutil/bloom ``` ## Examples diff --git a/ltcutil/bloom/example_test.go b/ltcutil/bloom/example_test.go index 2c1202afd9..0ae6ef3da6 100644 --- a/ltcutil/bloom/example_test.go +++ b/ltcutil/bloom/example_test.go @@ -9,9 +9,9 @@ import ( "math/rand" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil/bloom" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/bloom" + "github.com/ltcmweb/ltcd/wire" ) // This example demonstrates how to create a new bloom filter, add a transaction diff --git a/ltcutil/bloom/filter.go b/ltcutil/bloom/filter.go index 0b905d31ec..ad402caa51 100644 --- a/ltcutil/bloom/filter.go +++ b/ltcutil/bloom/filter.go @@ -9,10 +9,10 @@ import ( "math" "sync" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // ln2Squared is simply the square of the natural log of 2. diff --git a/ltcutil/bloom/filter_test.go b/ltcutil/bloom/filter_test.go index 175082050d..a0cb46646f 100644 --- a/ltcutil/bloom/filter_test.go +++ b/ltcutil/bloom/filter_test.go @@ -9,10 +9,10 @@ import ( "encoding/hex" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/bloom" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/bloom" + "github.com/ltcmweb/ltcd/wire" ) // TestFilterLarge ensures a maximum sized filter can be created. diff --git a/ltcutil/bloom/merkleblock.go b/ltcutil/bloom/merkleblock.go index f1a6e97533..be22346a6f 100644 --- a/ltcutil/bloom/merkleblock.go +++ b/ltcutil/bloom/merkleblock.go @@ -5,10 +5,10 @@ package bloom import ( - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // merkleBlock is used to house intermediate information needed to generate a @@ -21,6 +21,15 @@ type merkleBlock struct { bits []byte } +type MerkleExtractResult struct { + Root *chainhash.Hash + Match []*chainhash.Hash + Index []uint32 + bitsUsed int + hashUsed int + bad bool +} + // calcTreeWidth calculates and returns the number of nodes (width) or a // merkle tree at the given depth-first height. func (m *merkleBlock) calcTreeWidth(height uint32) uint32 { @@ -78,6 +87,112 @@ func (m *merkleBlock) traverseAndBuild(height, pos uint32) { } } +func (m *merkleBlock) traverseAndExtract(height, pos uint32, + res *MerkleExtractResult) *chainhash.Hash { + + if res.bitsUsed >= len(m.bits) { + // Overflowed the bits array - failure + res.bad = true + return &chainhash.Hash{} + } + parentOfMatch := m.bits[res.bitsUsed] > 0 + res.bitsUsed++ + + if height == 0 || !parentOfMatch { + // If at height 0, or nothing interesting below, + // use stored hash and do not descend + + if res.hashUsed >= len(m.finalHashes) { + // Overflowed the hash array - failure + res.bad = true + return &chainhash.Hash{} + } + hash := m.finalHashes[res.hashUsed] + res.hashUsed++ + + if height == 0 && parentOfMatch { + // In case of height 0, we have a matched txid + res.Match = append(res.Match, hash) + res.Index = append(res.Index, pos) + } + return hash + + } else { + // Otherwise, descend into the subtrees to extract + // matched txids and hashes + left := m.traverseAndExtract(height-1, pos*2, res) + right := left + + if pos*2+1 < m.calcTreeWidth(height-1) { + right = m.traverseAndExtract(height-1, pos*2+1, res) + + if left.IsEqual(right) { + // The left and right branches should never be + // identical, as the transaction hashes covered + // by them must each be unique. + res.bad = true + } + } + + // Combine them before returning + hash := blockchain.HashMerkleBranches(left, right) + return &hash + } +} + +func (m *merkleBlock) extractMatches() (res *MerkleExtractResult) { + res = &MerkleExtractResult{} + + // An empty set will not work + if m.numTx == 0 { + return + } + + // Check for excessively high numbers of transactions + if m.numTx > blockchain.MaxOutputsPerBlock { + return + } + + // There can never be more hashes provided than one for every txid + if uint32(len(m.finalHashes)) > m.numTx { + return + } + + // There must be at least one bit per node in the partial tree, + // and at least one node per hash + if len(m.bits) < len(m.finalHashes) { + return + } + + // Calculate height of tree + var height uint32 + for m.calcTreeWidth(height) > 1 { + height++ + } + + // Traverse the partial tree + hashMerkleRoot := m.traverseAndExtract(height, 0, res) + + // Verify that no problems occurred during the tree traversal + if res.bad { + return + } + + // Verify that all bits were consumed (except for the padding + // caused by serializing it as a byte sequence) + if (res.bitsUsed+7)/8 != (len(m.bits)+7)/8 { + return + } + + // Verify that all hashes were consumed + if res.hashUsed != len(m.finalHashes) { + return + } + + res.Root = hashMerkleRoot + return +} + // NewMerkleBlock returns a new *wire.MsgMerkleBlock and an array of the matched // transaction index numbers based on the passed block and filter. func NewMerkleBlock(block *ltcutil.Block, filter *Filter) (*wire.MsgMerkleBlock, []uint32) { @@ -124,3 +239,16 @@ func NewMerkleBlock(block *ltcutil.Block, filter *Filter) (*wire.MsgMerkleBlock, } return &msgMerkleBlock, matchedIndices } + +// VerifyMerkleBlock verifies the integrity of a merkle block. +func VerifyMerkleBlock(msgMerkleBlock *wire.MsgMerkleBlock) *MerkleExtractResult { + mBlock := &merkleBlock{ + numTx: msgMerkleBlock.Transactions, + finalHashes: msgMerkleBlock.Hashes, + bits: make([]byte, len(msgMerkleBlock.Flags)*8), + } + for i := range mBlock.bits { + mBlock.bits[i] = msgMerkleBlock.Flags[i/8] & (1 << (i % 8)) + } + return mBlock.extractMatches() +} diff --git a/ltcutil/bloom/merkleblock_test.go b/ltcutil/bloom/merkleblock_test.go index 30f0bf3264..cfb3c464eb 100644 --- a/ltcutil/bloom/merkleblock_test.go +++ b/ltcutil/bloom/merkleblock_test.go @@ -9,10 +9,10 @@ import ( "encoding/hex" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/bloom" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/bloom" + "github.com/ltcmweb/ltcd/wire" ) func TestMerkleBlock3(t *testing.T) { diff --git a/ltcutil/bloom/murmurhash3_test.go b/ltcutil/bloom/murmurhash3_test.go index b3426b5d3c..0d3b541c7d 100644 --- a/ltcutil/bloom/murmurhash3_test.go +++ b/ltcutil/bloom/murmurhash3_test.go @@ -7,7 +7,7 @@ package bloom_test import ( "testing" - "github.com/ltcsuite/ltcd/ltcutil/bloom" + "github.com/ltcmweb/ltcd/ltcutil/bloom" ) // TestMurmurHash3 ensure the MurmurHash3 function produces the correct hash diff --git a/ltcutil/certgen_test.go b/ltcutil/certgen_test.go index 5349a9c9ae..84b3a322af 100644 --- a/ltcutil/certgen_test.go +++ b/ltcutil/certgen_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" //"github.com/davecgh/go-spew/spew" ) diff --git a/ltcutil/coinset/README.md b/ltcutil/coinset/README.md index e661a93150..5afbd96fdf 100644 --- a/ltcutil/coinset/README.md +++ b/ltcutil/coinset/README.md @@ -15,7 +15,7 @@ report. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/coinset +$ go get -u github.com/ltcmweb/ltcd/ltcutil/coinset ``` ## Usage diff --git a/ltcutil/coinset/coins.go b/ltcutil/coinset/coins.go index 3afdb5aa61..4030e2c82d 100644 --- a/ltcutil/coinset/coins.go +++ b/ltcutil/coinset/coins.go @@ -9,9 +9,9 @@ import ( "errors" "sort" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // Coin represents a spendable transaction outpoint diff --git a/ltcutil/coinset/coins_test.go b/ltcutil/coinset/coins_test.go index e7c0466211..0cf3ebfcbc 100644 --- a/ltcutil/coinset/coins_test.go +++ b/ltcutil/coinset/coins_test.go @@ -11,10 +11,10 @@ import ( "fmt" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/coinset" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/coinset" + "github.com/ltcmweb/ltcd/wire" ) type TestCoin struct { diff --git a/ltcutil/example_test.go b/ltcutil/example_test.go index f537cd6d70..93049ec24d 100644 --- a/ltcutil/example_test.go +++ b/ltcutil/example_test.go @@ -4,7 +4,7 @@ import ( "fmt" "math" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) func ExampleAmount() { diff --git a/ltcutil/gcs/README.md b/ltcutil/gcs/README.md index 8964a2e88f..ec7ef61b62 100644 --- a/ltcutil/gcs/README.md +++ b/ltcutil/gcs/README.md @@ -15,7 +15,7 @@ A comprehensive suite of tests is provided to ensure proper functionality. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/gcs +$ go get -u github.com/ltcmweb/ltcd/ltcutil/gcs ``` ## License diff --git a/ltcutil/gcs/builder/builder.go b/ltcutil/gcs/builder/builder.go index 4c88d99fb6..0b6de7fe6f 100644 --- a/ltcutil/gcs/builder/builder.go +++ b/ltcutil/gcs/builder/builder.go @@ -10,10 +10,10 @@ import ( "fmt" "math" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil/gcs" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/gcs" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/ltcutil/gcs/builder/builder_test.go b/ltcutil/gcs/builder/builder_test.go index 44d9a2e79f..7a23f9b1e4 100644 --- a/ltcutil/gcs/builder/builder_test.go +++ b/ltcutil/gcs/builder/builder_test.go @@ -9,13 +9,13 @@ import ( "encoding/hex" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/gcs" - "github.com/ltcsuite/ltcd/ltcutil/gcs/builder" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/gcs" + "github.com/ltcmweb/ltcd/ltcutil/gcs/builder" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/ltcutil/gcs/gcs.go b/ltcutil/gcs/gcs.go index 3276b355c3..b4c9f4d723 100644 --- a/ltcutil/gcs/gcs.go +++ b/ltcutil/gcs/gcs.go @@ -13,7 +13,7 @@ import ( "github.com/aead/siphash" "github.com/kkdai/bstream" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // Inspired by https://github.com/rasky/gcs diff --git a/ltcutil/gcs/gcs_test.go b/ltcutil/gcs/gcs_test.go index 18a0d0fe6b..e869728040 100644 --- a/ltcutil/gcs/gcs_test.go +++ b/ltcutil/gcs/gcs_test.go @@ -11,7 +11,7 @@ import ( "math/rand" "testing" - "github.com/ltcsuite/ltcd/ltcutil/gcs" + "github.com/ltcmweb/ltcd/ltcutil/gcs" ) var ( diff --git a/ltcutil/gcs/gcsbench_test.go b/ltcutil/gcs/gcsbench_test.go index 8c120a1f8d..64012e5449 100644 --- a/ltcutil/gcs/gcsbench_test.go +++ b/ltcutil/gcs/gcsbench_test.go @@ -10,7 +10,7 @@ import ( "math/rand" "testing" - "github.com/ltcsuite/ltcd/ltcutil/gcs" + "github.com/ltcmweb/ltcd/ltcutil/gcs" ) func genRandFilterElements(numElements uint) ([][]byte, error) { diff --git a/ltcutil/go.mod b/ltcutil/go.mod deleted file mode 100644 index 54021c5cdc..0000000000 --- a/ltcutil/go.mod +++ /dev/null @@ -1,14 +0,0 @@ -module github.com/ltcsuite/ltcd/ltcutil - -go 1.16 - -require ( - github.com/aead/siphash v1.0.1 - github.com/davecgh/go-spew v1.1.1 - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 - github.com/kkdai/bstream v1.0.0 - github.com/ltcsuite/ltcd v0.23.5 - github.com/ltcsuite/ltcd/btcec/v2 v2.3.2 - github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 - golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a -) diff --git a/ltcutil/go.sum b/ltcutil/go.sum deleted file mode 100644 index ccb4ffec73..0000000000 --- a/ltcutil/go.sum +++ /dev/null @@ -1,107 +0,0 @@ -github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kkdai/bstream v1.0.0 h1:Se5gHwgp2VT2uHfDrkbbgbgEvV9cimLELwrPJctSjg8= -github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/ltcsuite/ltcd v0.23.5 h1:MFWjmx2hCwxrUu9v0wdIPOSN7PHg9BWQeh+AO4FsVLI= -github.com/ltcsuite/ltcd v0.23.5/go.mod h1:JV6swXR5m0cYFi0VYdQPp3UnMdaDQxaRUCaU1PPjb+g= -github.com/ltcsuite/ltcd/btcec/v2 v2.3.2 h1:HVArUNQGqGaSSoyYkk9qGht74U0/uNhS0n7jV9rkmno= -github.com/ltcsuite/ltcd/btcec/v2 v2.3.2/go.mod h1:T1t5TjbjPnryvlGQ+RpSKGuU8KhjNN7rS5+IznPj1VM= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 h1:xuWxvRKxLvOKuS7/Q/7I3tpc3cWAB0+hZpU8YdVqkzg= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2/go.mod h1:nkLkAFGhursWf2U68gt61hPieK1I+0m78e+2aevNyD8= -github.com/ltcsuite/ltcd/ltcutil v1.1.3/go.mod h1:z8txd/ohBFrOMBUT70K8iZvHJD/Vc3gzx+6BP6cBxQw= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= -lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= diff --git a/ltcutil/hdkeychain/README.md b/ltcutil/hdkeychain/README.md index a8f72847f2..551ffc8361 100644 --- a/ltcutil/hdkeychain/README.md +++ b/ltcutil/hdkeychain/README.md @@ -38,7 +38,7 @@ report. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/hdkeychain +$ go get -u github.com/ltcmweb/ltcd/ltcutil/hdkeychain ``` ## Examples diff --git a/ltcutil/hdkeychain/bench_test.go b/ltcutil/hdkeychain/bench_test.go index 898577253c..ed203cd30a 100644 --- a/ltcutil/hdkeychain/bench_test.go +++ b/ltcutil/hdkeychain/bench_test.go @@ -7,7 +7,7 @@ package hdkeychain_test import ( "testing" - "github.com/ltcsuite/ltcd/ltcutil/hdkeychain" + "github.com/ltcmweb/ltcd/ltcutil/hdkeychain" ) // bip0032MasterPriv1 is the master private extended key from the first set of diff --git a/ltcutil/hdkeychain/example_test.go b/ltcutil/hdkeychain/example_test.go index 6d28b52784..293d6d8c33 100644 --- a/ltcutil/hdkeychain/example_test.go +++ b/ltcutil/hdkeychain/example_test.go @@ -7,8 +7,8 @@ package hdkeychain_test import ( "fmt" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil/hdkeychain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil/hdkeychain" ) // This example demonstrates how to generate a cryptographically random seed diff --git a/ltcutil/hdkeychain/extendedkey.go b/ltcutil/hdkeychain/extendedkey.go index 09dbaff997..a3b3953e13 100644 --- a/ltcutil/hdkeychain/extendedkey.go +++ b/ltcutil/hdkeychain/extendedkey.go @@ -18,11 +18,11 @@ import ( "fmt" "math/big" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/base58" ) const ( diff --git a/ltcutil/hdkeychain/extendedkey_test.go b/ltcutil/hdkeychain/extendedkey_test.go index 38da0c7a52..b27c9f71dd 100644 --- a/ltcutil/hdkeychain/extendedkey_test.go +++ b/ltcutil/hdkeychain/extendedkey_test.go @@ -18,7 +18,7 @@ import ( "testing" secp_ecdsa "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg" ) // TestBIP0032Vectors tests the vectors provided by [BIP32] to ensure the diff --git a/ltcutil/internal_test.go b/ltcutil/internal_test.go index 887ab536a0..719e394013 100644 --- a/ltcutil/internal_test.go +++ b/ltcutil/internal_test.go @@ -12,9 +12,9 @@ interface. The functions are only exported while the tests are being run. package ltcutil import ( - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/ltcutil/base58" - "github.com/ltcsuite/ltcd/ltcutil/bech32" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/ltcutil/bech32" "golang.org/x/crypto/ripemd160" ) diff --git a/ltcutil/mweb/coin.go b/ltcutil/mweb/coin.go new file mode 100644 index 0000000000..c3ad4ac636 --- /dev/null +++ b/ltcutil/mweb/coin.go @@ -0,0 +1,110 @@ +package mweb + +import ( + "encoding/binary" + "errors" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "github.com/ltcmweb/ltcd/wire" + "lukechampine.com/blake3" +) + +// Represents an output owned by the wallet, or one sent by the wallet. +type Coin struct { + // The private key needed in order to spend the coin. + // Will be nil for watch-only wallets. + // May be nil for locked wallets. Upon unlock, SpendKey will get populated. + SpendKey *mw.SecretKey + + // The blinding factor of the coin's output. + // May be nil for watch-only wallets. + Blind *mw.BlindingFactor + + // The output amount in litoshis. + // Typically positive, but could be 0 in the future + // when we start using decoys to improve privacy. + Value uint64 + + // The output's ID (hash). + OutputId *chainhash.Hash + + // The ephemeral private key used by the sender to create the output. + // This will only be populated when the coin has flag HAS_SENDER_INFO. + SenderKey *mw.SecretKey + + // The StealthAddress the coin was sent to. + // This will only be populated when the coin has flag HAS_SENDER_INFO. + Address *mw.StealthAddress + + // The shared secret used to generate the output key. + // By storing this, we are able to postpone calculation of the spend key. + // This allows us to scan for outputs while wallet is locked, and recalculate + // the output key once the wallet becomes unlocked. + SharedSecret *mw.SecretKey +} + +func RewindOutput(output *wire.MwebOutput, + scanSecret *mw.SecretKey) (coin *Coin, err error) { + + defer func() { + if r := recover(); r != nil { + err = errors.New("output is bad") + } + }() + + if output.Message.Features&wire.MwebOutputMessageStandardFieldsFeatureBit == 0 { + return nil, errors.New("output doesn't have standard fields") + } + + sharedSecret := output.Message.KeyExchangePubKey.Mul(scanSecret) + viewTag := mw.Hashed(mw.HashTagTag, sharedSecret[:])[0] + if viewTag != output.Message.ViewTag { + return nil, errors.New("view tag mismatch") + } + + t := (*mw.SecretKey)(mw.Hashed(mw.HashTagDerive, sharedSecret[:])) + B_i := output.ReceiverPubKey.Div((*mw.SecretKey)(mw.Hashed(mw.HashTagOutKey, t[:]))) + + // Check if B_i belongs to wallet + address := &mw.StealthAddress{Scan: B_i.Mul(scanSecret), Spend: B_i} + + // Calc blinding factor and unmask nonce and amount + mask := mw.OutputMaskFromShared(t) + value := mask.MaskValue(output.Message.MaskedValue) + n := mask.MaskNonce(&output.Message.MaskedNonce) + + if *mw.SwitchCommit(mask.Blind, value) != output.Commitment { + return nil, errors.New("commitment mismatch") + } + + // Calculate Carol's sending key 's' and check that s*B ?= Ke + h := blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, mw.HashTagSendKey) + h.Write(address.A()[:]) + h.Write(address.B()[:]) + binary.Write(h, binary.LittleEndian, value) + h.Write(n.FillBytes(make([]byte, 16))) + s := (*mw.SecretKey)(h.Sum(nil)) + + if output.Message.KeyExchangePubKey != *address.B().Mul(s) { + return nil, errors.New("key exchange pubkey mismatch") + } + + return &Coin{ + Blind: mask.Blind, + Value: value, + OutputId: output.Hash(), + Address: address, + SharedSecret: t, + }, nil +} + +func (coin *Coin) CalculateOutputKey(spendKey *mw.SecretKey) { + if coin.SpendKey != nil || coin.SharedSecret == nil { + return + } + coin.SpendKey = spendKey.Mul( + (*mw.SecretKey)(mw.Hashed(mw.HashTagOutKey, coin.SharedSecret[:])), + ) +} diff --git a/ltcutil/mweb/coin_test.go b/ltcutil/mweb/coin_test.go new file mode 100644 index 0000000000..d0747e7de9 --- /dev/null +++ b/ltcutil/mweb/coin_test.go @@ -0,0 +1,73 @@ +package mweb_test + +import ( + "bytes" + "encoding/hex" + "testing" + + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/mweb" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "github.com/ltcmweb/ltcd/wire" + "lukechampine.com/blake3" +) + +var ( + outputRawBytes = "" + + "087c3e31a61d3d46bdb13729d3c4ac39da15fb13f3e1b1e0e1abdbbc52ca03f0" + + "2d031a4777fdfcbb3594ac4f7b57a1ad4343d27601e8542cac591733098d41e4" + + "9c5002e44d6d8cbdb20d58b39a3294ea6e94031ae09e4a489e4f484ceea0df6c" + + "467a76010334bab2ce38ea861e61d92386b4bdbb916ce3b481ce996ad5e62c2f" + + "6801fa8e4e51f84fd893a8c658fcca5b70966568af374bfb0e75f24830ca0000" + + "000000000000000000000000000000000000000000000000000000000000c090" + + "05a93313d9d9ea3805655f5474e3f39db5ae4d0bc29c6ab3f3aded78e46da942" + + "a4ec525fbf41cbb3e9bf878bbe0c26dba6f44250cc55c82a7fd1eb90a51ceda0" + + "89ee46105283bb99cf465eb1bc901c62e289e3e710ec8df7daeaab187b9e" + + scanKeyBytes = "164c6001b2623ed37be1c776567d12fe28c82664bd7497e63b0efcddb5b3ec48" + spendKeyBytes = "ef66d0e0f7d2c59b3d7f5837ac4831ed0805f8f48f8bfd574a7fafc065b5747f" + senderKeyBytes = "46ea6b248ba712462007aad44d06d8cb2f05c2ab737a8fc3e0ff328676fa40e7" +) + +func TestSignature(t *testing.T) { + outputRawBytes, _ := hex.DecodeString(outputRawBytes) + output := &wire.MwebOutput{} + output.Deserialize(bytes.NewReader(outputRawBytes)) + senderKey, _ := hex.DecodeString(senderKeyBytes) + + h := blake3.New(32, nil) + h.Write(output.Commitment[:]) + h.Write(output.SenderPubKey[:]) + h.Write(output.ReceiverPubKey[:]) + h.Write(output.Message.Hash()[:]) + h.Write(output.RangeProofHash[:]) + + if mw.Sign((*mw.SecretKey)(senderKey), h.Sum(nil)) != output.Signature { + t.Error("unexpected signature") + } +} + +func TestRewindOutput(t *testing.T) { + outputRawBytes, _ := hex.DecodeString(outputRawBytes) + output := &wire.MwebOutput{} + output.Deserialize(bytes.NewReader(outputRawBytes)) + scan, _ := hex.DecodeString(scanKeyBytes) + spend, _ := hex.DecodeString(spendKeyBytes) + keys := &mweb.Keychain{Scan: (*mw.SecretKey)(scan), Spend: (*mw.SecretKey)(spend)} + coin, err := mweb.RewindOutput(output, keys.Scan) + if err != nil { + t.Fatalf("RewindOutput failed: %s", err.Error()) + } + if coin.Value != 0.1*ltcutil.SatoshiPerBitcoin { + t.Error("unexpected value") + } + if !coin.Address.Equal(keys.Address(0)) { + t.Error("unexpected address") + } + addr := ltcutil.NewAddressMweb(coin.Address, &chaincfg.TestNet4Params) + if addr.String() != "tmweb1qqv0mlyyk7sl09jkcrgy059m5yplw567ypuj6lxpwkcw4tl8m59p7wq6jc"+ + "6prtph5kf45kdlql8fjppr32nmwng34fs6ess9fq72ck7lfyvmr6s0c" { + t.Error("unexpected address") + } +} diff --git a/ltcutil/mweb/fees.go b/ltcutil/mweb/fees.go new file mode 100644 index 0000000000..0410af00b6 --- /dev/null +++ b/ltcutil/mweb/fees.go @@ -0,0 +1,48 @@ +package mweb + +import ( + "math" + + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" +) + +const ( + BaseMwebFee = 100 + + BaseKernelWeight = 2 + StealthExcessWeight = 1 + KernelWithStealthWeight = BaseKernelWeight + StealthExcessWeight + + BaseOutputWeight = 17 + StandardOutputFieldsWeight = 1 + StandardOutputWeight = BaseOutputWeight + StandardOutputFieldsWeight + + // For any extra data added to inputs, outputs or kernels + BytesPerWeight = 42 +) + +func EstimateFee(outputs []*wire.TxOut, + feeRatePerKb ltcutil.Amount, includeChange bool) uint64 { + + var weight uint64 = KernelWithStealthWeight + var txOutSize int + + for _, txOut := range outputs { + if txscript.IsMweb(txOut.PkScript) { + weight += StandardOutputWeight + } else { + weight += (uint64(len(txOut.PkScript)) + + BytesPerWeight - 1) / BytesPerWeight + txOutSize += txOut.SerializeSize() + } + } + + if includeChange { + weight += StandardOutputWeight + } + + fee := math.Ceil(float64(feeRatePerKb) * float64(txOutSize) / 1000) + return uint64(fee) + weight*BaseMwebFee +} diff --git a/ltcutil/mweb/header.go b/ltcutil/mweb/header.go new file mode 100644 index 0000000000..ae9168232d --- /dev/null +++ b/ltcutil/mweb/header.go @@ -0,0 +1,69 @@ +package mweb + +import ( + "bytes" + "errors" + "fmt" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/bloom" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" + "lukechampine.com/blake3" +) + +func VerifyHeader(mwebHeader *wire.MsgMwebHeader) error { + extractResult := bloom.VerifyMerkleBlock(&mwebHeader.Merkle) + if !extractResult.Root.IsEqual(&mwebHeader.Merkle.Header.MerkleRoot) { + return errors.New("mwebheader merkle block is bad") + } + + if !mwebHeader.Hogex.IsHogEx { + return errors.New("mwebheader hogex is not hogex") + } + + // Validate that the hash of the HogEx transaction in the tx message + // matches the hash in the merkleblock message, and that it's the + // last transaction committed to by the merkle root of the block. + + finalTx := extractResult.Match[len(extractResult.Match)-1] + if mwebHeader.Hogex.TxHash() != *finalTx { + return fmt.Errorf("tx hash mismatch, hogex=%v, last merkle tx=%v", + mwebHeader.Hogex.TxHash(), *finalTx) + } + + finalTxPos := extractResult.Index[len(extractResult.Index)-1] + if finalTxPos != mwebHeader.Merkle.Transactions-1 { + return fmt.Errorf("tx index mismatch, got=%v, expected=%v", + finalTxPos, mwebHeader.Merkle.Transactions-1) + } + + // Validate that the pubkey script of the first output contains + // the HogAddr, which shall consist of <0x20> followed by + // the 32-byte hash of the MWEB header. + + script, _ := txscript.NewScriptBuilder(). + AddOp(txscript.MwebHogAddrWitnessVersion + txscript.OP_1 - 1). + AddData(mwebHeader.MwebHeader.Hash()[:]).Script() + if !bytes.Equal(mwebHeader.Hogex.TxOut[0].PkScript, script) { + return fmt.Errorf("HogAddr mismatch, hogex=%v, expected=%v", + mwebHeader.Hogex.TxOut[0].PkScript, script) + } + + return nil +} + +func VerifyLeafset(mwebHeader *wire.MsgMwebHeader, + mwebLeafset *wire.MsgMwebLeafset) error { + + // Verify that the hash of the leafset bitmap matches the + // leafset_root value in the MWEB header. + + leafsetRoot := chainhash.Hash(blake3.Sum256(mwebLeafset.Leafset)) + if leafsetRoot != mwebHeader.MwebHeader.LeafsetRoot { + return fmt.Errorf("leafset root mismatch, leafset=%v, header=%v", + leafsetRoot, mwebHeader.MwebHeader.LeafsetRoot) + } + + return nil +} diff --git a/ltcutil/mweb/keychain.go b/ltcutil/mweb/keychain.go new file mode 100644 index 0000000000..80e1268a2b --- /dev/null +++ b/ltcutil/mweb/keychain.go @@ -0,0 +1,34 @@ +package mweb + +import ( + "encoding/binary" + + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "lukechampine.com/blake3" +) + +type Keychain struct { + Scan, Spend *mw.SecretKey + SpendPubKey *mw.PublicKey +} + +func (k *Keychain) mi(index uint32) *mw.SecretKey { + h := blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, mw.HashTagAddress) + binary.Write(h, binary.LittleEndian, index) + h.Write(k.Scan[:]) + return (*mw.SecretKey)(h.Sum(nil)) +} + +func (k *Keychain) Address(index uint32) *mw.StealthAddress { + if k.SpendPubKey == nil { + k.SpendPubKey = k.Spend.PubKey() + } + Bi := k.SpendPubKey.Add(k.mi(index).PubKey()) + Ai := Bi.Mul(k.Scan) + return &mw.StealthAddress{Scan: Ai, Spend: Bi} +} + +func (k *Keychain) SpendKey(index uint32) *mw.SecretKey { + return k.Spend.Add(k.mi(index)) +} diff --git a/ltcutil/mweb/leafset.go b/ltcutil/mweb/leafset.go new file mode 100644 index 0000000000..c55e002153 --- /dev/null +++ b/ltcutil/mweb/leafset.go @@ -0,0 +1,64 @@ +package mweb + +import ( + "encoding/binary" + "io" + + "github.com/ltcmweb/ltcd/wire" +) + +type Leafset struct { + Bits []byte + Size uint64 + Height uint32 + Block *wire.BlockHeader +} + +func (l *Leafset) Contains(i uint64) bool { + if i >= l.Size { + return false + } + return l.Bits[i/8]&(0x80>>(i%8)) > 0 +} + +func (l *Leafset) Serialize(w io.Writer) error { + err := binary.Write(w, binary.LittleEndian, l.Size) + if err != nil { + return err + } + + err = binary.Write(w, binary.LittleEndian, l.Height) + if err != nil { + return err + } + + err = l.Block.Serialize(w) + if err != nil { + return err + } + + _, err = w.Write(l.Bits) + return err +} + +func (l *Leafset) Deserialize(r io.Reader) error { + err := binary.Read(r, binary.LittleEndian, &l.Size) + if err != nil { + return err + } + + err = binary.Read(r, binary.LittleEndian, &l.Height) + if err != nil { + return err + } + + l.Block = &wire.BlockHeader{} + err = l.Block.Deserialize(r) + if err != nil { + return err + } + + l.Bits = make([]byte, (l.Size+7)/8) + _, err = r.Read(l.Bits) + return err +} diff --git a/ltcutil/mweb/mw/blindingfactor.go b/ltcutil/mweb/mw/blindingfactor.go new file mode 100644 index 0000000000..50d2a3c956 --- /dev/null +++ b/ltcutil/mweb/mw/blindingfactor.go @@ -0,0 +1,42 @@ +package mw + +import ( + "crypto/sha256" + + "github.com/decred/dcrd/dcrec/secp256k1/v4" +) + +type BlindingFactor [32]byte + +var generatorJ = PublicKey{ + 0x02, + 0xb8, 0x60, 0xf5, 0x67, 0x95, 0xfc, 0x03, 0xf3, + 0xc2, 0x16, 0x85, 0x38, 0x3d, 0x1b, 0x5a, 0x2f, + 0x29, 0x54, 0xf4, 0x9b, 0x7e, 0x39, 0x8b, 0x8d, + 0x2a, 0x01, 0x93, 0x93, 0x36, 0x21, 0x15, 0x5f, +} + +func (b *BlindingFactor) scalar() *secp256k1.ModNScalar { + k := &secp256k1.ModNScalar{} + if k.SetBytes((*[32]byte)(b)) > 0 { + panic("overflowed") + } + return k +} + +func (b *BlindingFactor) Add(blind *BlindingFactor) *BlindingFactor { + r := BlindingFactor(b.scalar().Add(blind.scalar()).Bytes()) + return &r +} + +func (b *BlindingFactor) Sub(blind *BlindingFactor) *BlindingFactor { + r := BlindingFactor(b.scalar().Add(blind.scalar().Negate()).Bytes()) + return &r +} + +func BlindSwitch(blind *BlindingFactor, value uint64) *BlindingFactor { + h := sha256.New() + h.Write(NewCommitment(blind, value)[:]) + h.Write(generatorJ.mul(blind.scalar())[:]) + return (*BlindingFactor)(h.Sum(nil)).Add(blind) +} diff --git a/ltcutil/mweb/mw/commitment.go b/ltcutil/mweb/mw/commitment.go new file mode 100644 index 0000000000..610806c04e --- /dev/null +++ b/ltcutil/mweb/mw/commitment.go @@ -0,0 +1,88 @@ +package mw + +import ( + "encoding/binary" + + "github.com/decred/dcrd/dcrec/secp256k1/v4" +) + +type Commitment [33]byte + +func generatorH() *secp256k1.JacobianPoint { + var generatorH = [64]byte{ + 0x50, 0x92, 0x9b, 0x74, 0xc1, 0xa0, 0x49, 0x54, + 0xb7, 0x8b, 0x4b, 0x60, 0x35, 0xe9, 0x7a, 0x5e, + 0x07, 0x8a, 0x5a, 0x0f, 0x28, 0xec, 0x96, 0xd5, + 0x47, 0xbf, 0xee, 0x9a, 0xce, 0x80, 0x3a, 0xc0, + 0x31, 0xd3, 0xc6, 0x86, 0x39, 0x73, 0x92, 0x6e, + 0x04, 0x9e, 0x63, 0x7c, 0xb1, 0xb5, 0xf4, 0x0a, + 0x36, 0xda, 0xc2, 0x8a, 0xf1, 0x76, 0x69, 0x68, + 0xc3, 0x0c, 0x23, 0x13, 0xf3, 0xa3, 0x89, 0x04, + } + var H secp256k1.JacobianPoint + H.X.SetByteSlice(generatorH[:32]) + H.Y.SetByteSlice(generatorH[32:]) + H.Z.SetInt(1) + return &H +} + +func NewCommitment(blind *BlindingFactor, value uint64) *Commitment { + var v secp256k1.ModNScalar + var b, r secp256k1.JacobianPoint + v.SetByteSlice(binary.BigEndian.AppendUint64(nil, value)) + secp256k1.ScalarBaseMultNonConst(blind.scalar(), &b) + secp256k1.ScalarMultNonConst(&v, generatorH(), &r) + secp256k1.AddNonConst(&b, &r, &r) + return toCommitment(&r) +} + +func toCommitment(r *secp256k1.JacobianPoint) *Commitment { + r.ToAffine() + c := &Commitment{8} + r.X.PutBytesUnchecked(c[1:]) + if !r.X.SquareRootVal(&r.Y) { + c[0]++ + } + return c +} + +func SwitchCommit(blind *BlindingFactor, value uint64) *Commitment { + return NewCommitment(BlindSwitch(blind, value), value) +} + +func (c *Commitment) toJacobian() *secp256k1.JacobianPoint { + var r secp256k1.JacobianPoint + var t secp256k1.FieldVal + if r.X.SetByteSlice(c[1:]) { + panic("overflowed") + } + if !r.Y.SquareRootVal(t.SquareVal(&r.X).Mul(&r.X).AddInt(7)) { + panic("invalid commitment") + } + if c[0]&1 > 0 { + r.Y.Negate(1) + } + r.Z.SetInt(1) + return &r +} + +func (pk *PublicKey) Commitment() *Commitment { + return toCommitment(pk.toJacobian()) +} + +func (c *Commitment) PubKey() *PublicKey { + return toPubKey(c.toJacobian()) +} + +func (c *Commitment) Add(c2 *Commitment) *Commitment { + r := c2.toJacobian() + secp256k1.AddNonConst(c.toJacobian(), r, r) + return toCommitment(r) +} + +func (c *Commitment) Sub(c2 *Commitment) *Commitment { + r := c2.toJacobian() + r.Y.Negate(1) + secp256k1.AddNonConst(c.toJacobian(), r, r) + return toCommitment(r) +} diff --git a/ltcutil/mweb/mw/hasher.go b/ltcutil/mweb/mw/hasher.go new file mode 100644 index 0000000000..8612e977bf --- /dev/null +++ b/ltcutil/mweb/mw/hasher.go @@ -0,0 +1,28 @@ +package mw + +import ( + "encoding/binary" + + "lukechampine.com/blake3" +) + +type HashTag byte + +const ( + HashTagAddress HashTag = 'A' + HashTagBlind HashTag = 'B' + HashTagDerive HashTag = 'D' + HashTagNonce HashTag = 'N' + HashTagOutKey HashTag = 'O' + HashTagSendKey HashTag = 'S' + HashTagTag HashTag = 'T' + HashTagNonceMask HashTag = 'X' + HashTagValueMask HashTag = 'Y' +) + +func Hashed(tag HashTag, data []byte) *[32]byte { + h := blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, tag) + h.Write(data) + return (*[32]byte)(h.Sum(nil)) +} diff --git a/ltcutil/mweb/mw/outputmask.go b/ltcutil/mweb/mw/outputmask.go new file mode 100644 index 0000000000..ed31832c17 --- /dev/null +++ b/ltcutil/mweb/mw/outputmask.go @@ -0,0 +1,34 @@ +package mw + +import ( + "encoding/binary" + "math/big" +) + +type OutputMask struct { + Blind *BlindingFactor + valueMask uint64 + nonceMask big.Int +} + +// Feeds the shared secret 't' into tagged hash functions to derive: +// +// q - the blinding factor +// v' - the value mask +// n' - the nonce mask +func OutputMaskFromShared(sharedSecret *SecretKey) *OutputMask { + mask := &OutputMask{ + Blind: (*BlindingFactor)(Hashed(HashTagBlind, sharedSecret[:])), + valueMask: binary.LittleEndian.Uint64(Hashed(HashTagValueMask, sharedSecret[:])[:]), + } + mask.nonceMask.SetBytes(Hashed(HashTagNonceMask, sharedSecret[:])[:16]) + return mask +} + +func (om *OutputMask) MaskValue(value uint64) uint64 { + return value ^ om.valueMask +} + +func (om *OutputMask) MaskNonce(nonce *big.Int) *big.Int { + return new(big.Int).Xor(nonce, &om.nonceMask) +} diff --git a/ltcutil/mweb/mw/publickey.go b/ltcutil/mweb/mw/publickey.go new file mode 100644 index 0000000000..802b18b26d --- /dev/null +++ b/ltcutil/mweb/mw/publickey.go @@ -0,0 +1,48 @@ +package mw + +import "github.com/decred/dcrd/dcrec/secp256k1/v4" + +type PublicKey [33]byte + +func (pk *PublicKey) toJacobian() *secp256k1.JacobianPoint { + key, err := secp256k1.ParsePubKey(pk[:]) + if err != nil { + panic(err) + } + var r secp256k1.JacobianPoint + key.AsJacobian(&r) + return &r +} + +func toPubKey(r *secp256k1.JacobianPoint) *PublicKey { + r.ToAffine() + key := secp256k1.NewPublicKey(&r.X, &r.Y) + return (*PublicKey)(key.SerializeCompressed()) +} + +func (pk *PublicKey) Add(p *PublicKey) *PublicKey { + r := p.toJacobian() + secp256k1.AddNonConst(pk.toJacobian(), r, r) + return toPubKey(r) +} + +func (pk *PublicKey) Sub(p *PublicKey) *PublicKey { + r := p.toJacobian() + r.Y.Negate(1) + secp256k1.AddNonConst(pk.toJacobian(), r, r) + return toPubKey(r) +} + +func (pk *PublicKey) mul(k *secp256k1.ModNScalar) *PublicKey { + r := pk.toJacobian() + secp256k1.ScalarMultNonConst(k, r, r) + return toPubKey(r) +} + +func (pk *PublicKey) Mul(sk *SecretKey) *PublicKey { + return pk.mul(sk.scalar()) +} + +func (pk *PublicKey) Div(sk *SecretKey) *PublicKey { + return pk.mul(sk.scalar().InverseNonConst()) +} diff --git a/ltcutil/mweb/mw/secretkey.go b/ltcutil/mweb/mw/secretkey.go new file mode 100644 index 0000000000..343f84cf9e --- /dev/null +++ b/ltcutil/mweb/mw/secretkey.go @@ -0,0 +1,45 @@ +package mw + +import "github.com/decred/dcrd/dcrec/secp256k1/v4" + +type SecretKey [32]byte + +func (s *SecretKey) scalar() *secp256k1.ModNScalar { + k := &secp256k1.ModNScalar{} + if k.SetBytes((*[32]byte)(s)) > 0 { + panic("overflowed") + } + return k +} + +func (s *SecretKey) Add(sk *SecretKey) *SecretKey { + r := SecretKey(s.scalar().Add(sk.scalar()).Bytes()) + return &r +} + +func (s *SecretKey) Sub(sk *SecretKey) *SecretKey { + return s.Add(sk.Neg()) +} + +func (s *SecretKey) Neg() *SecretKey { + r := SecretKey(s.scalar().Negate().Bytes()) + return &r +} + +func (s *SecretKey) Mul(sk *SecretKey) *SecretKey { + k := s.scalar() + if k.IsZero() { + return s + } + r := SecretKey(k.Mul(sk.scalar()).Bytes()) + return &r +} + +func (s *SecretKey) PubKey() *PublicKey { + k := s.scalar() + if k.IsZero() { + k.SetInt(1) + } + key := secp256k1.NewPrivateKey(k).PubKey() + return (*PublicKey)(key.SerializeCompressed()) +} diff --git a/ltcutil/mweb/mw/signature.go b/ltcutil/mweb/mw/signature.go new file mode 100644 index 0000000000..47116de1ad --- /dev/null +++ b/ltcutil/mweb/mw/signature.go @@ -0,0 +1,46 @@ +package mw + +import ( + "bytes" + "crypto/sha256" + + "github.com/decred/dcrd/dcrec/secp256k1/v4" +) + +type Signature [64]byte + +func Sign(key *SecretKey, msg []byte) (sig Signature) { + h := sha256.New() + h.Write(key[:]) + h.Write(msg) + k := (*SecretKey)(h.Sum(nil)) + + var r secp256k1.JacobianPoint + secp256k1.ScalarBaseMultNonConst(k.scalar(), &r) + r.ToAffine() + r.X.PutBytesUnchecked(sig[:]) + if !r.X.SquareRootVal(&r.Y) { + k = k.Neg() + } + + e := sig.challenge(key.PubKey(), msg) + copy(sig[32:], key.Mul(e).Add(k)[:]) + return +} + +func (sig *Signature) challenge(pk *PublicKey, msg []byte) *SecretKey { + h := sha256.New() + h.Write(sig[:32]) + h.Write(pk[:]) + h.Write(msg) + return (*SecretKey)(h.Sum(nil)) +} + +func (sig *Signature) Verify(pk *PublicKey, msg []byte) bool { + defer func() { recover() }() + S := (*SecretKey)(sig[32:]).PubKey() + e := sig.challenge(pk, msg) + K := pk.Mul(e.Neg()).Add(S) + r := K.toJacobian() + return bytes.Equal(K[1:], sig[:32]) && r.X.SquareRootVal(&r.Y) +} diff --git a/ltcutil/mweb/mw/signature_test.go b/ltcutil/mweb/mw/signature_test.go new file mode 100644 index 0000000000..7ce4c616c8 --- /dev/null +++ b/ltcutil/mweb/mw/signature_test.go @@ -0,0 +1,23 @@ +package mw_test + +import ( + "crypto/rand" + "testing" + + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" +) + +func TestSignature(t *testing.T) { + var ( + key mw.SecretKey + msg [32]byte + ) + for i := 0; i < 1e4; i++ { + rand.Read(key[:]) + rand.Read(msg[:]) + sig := mw.Sign(&key, msg[:]) + if !sig.Verify(key.PubKey(), msg[:]) { + t.Fatal("sig verify failed") + } + } +} diff --git a/ltcutil/mweb/mw/stealthaddress.go b/ltcutil/mweb/mw/stealthaddress.go new file mode 100644 index 0000000000..114addf05c --- /dev/null +++ b/ltcutil/mweb/mw/stealthaddress.go @@ -0,0 +1,17 @@ +package mw + +type StealthAddress struct { + Scan, Spend *PublicKey +} + +func (sa *StealthAddress) A() *PublicKey { + return sa.Scan +} + +func (sa *StealthAddress) B() *PublicKey { + return sa.Spend +} + +func (sa *StealthAddress) Equal(addr *StealthAddress) bool { + return *sa.Scan == *addr.Scan && *sa.Spend == *addr.Spend +} diff --git a/ltcutil/mweb/txbuilder.go b/ltcutil/mweb/txbuilder.go new file mode 100644 index 0000000000..21ce450fb0 --- /dev/null +++ b/ltcutil/mweb/txbuilder.go @@ -0,0 +1,306 @@ +package mweb + +import ( + "bytes" + "crypto/rand" + "encoding/binary" + "errors" + "math/big" + + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" + "github.com/ltcmweb/secp256k1" + "lukechampine.com/blake3" +) + +type ( + CreateInputsAndKernelFunc func(*mw.SecretKey, *mw.BlindingFactor) ( + []*wire.MwebInput, *wire.MwebKernel, *mw.BlindingFactor, error) + RandFunc func([]byte) error +) + +func NewTransaction(coins []*Coin, recipients []*Recipient, + fee, pegin uint64, pegouts []*wire.TxOut, randFunc RandFunc, + createInputsAndKernelFunc CreateInputsAndKernelFunc) ( + tx *wire.MwebTx, newCoins []*Coin, err error) { + + defer func() { + if r := recover(); r != nil { + err = errors.New("input coins are bad") + } + }() + + var sumCoins, sumRecipients, sumPegouts uint64 + for _, coin := range coins { + sumCoins += coin.Value + } + for _, recipient := range recipients { + sumRecipients += recipient.Value + } + for _, pegout := range pegouts { + sumPegouts += uint64(pegout.Value) + } + if sumCoins+pegin != sumRecipients+sumPegouts+fee { + return nil, nil, errors.New("total amount mismatch") + } + + if randFunc == nil { + randFunc = func(b []byte) error { + _, err := rand.Read(b) + return err + } + } + + outputs, newCoins, outputBlind, outputKey := createOutputs(recipients, randFunc) + + // Total kernel offset is split between raw kernel_offset + // and the kernel's blinding factor. + // sum(output.blind) - sum(input.blind) = kernel_offset + sum(kernel.blind) + var kernelOffset mw.BlindingFactor + if err := randFunc(kernelOffset[:]); err != nil { + return nil, nil, err + } + kernelBlind := outputBlind.Sub(&kernelOffset) + for _, coin := range coins { + kernelBlind = kernelBlind.Sub(mw.BlindSwitch(coin.Blind, coin.Value)) + } + + if createInputsAndKernelFunc == nil { + createInputsAndKernelFunc = func(outputKey *mw.SecretKey, + kernelBlind *mw.BlindingFactor) ([]*wire.MwebInput, + *wire.MwebKernel, *mw.BlindingFactor, error) { + return createInputsAndKernel(coins, outputKey, + kernelBlind, fee, pegin, pegouts, randFunc) + } + } + inputs, kernel, stealthOffset, err := + createInputsAndKernelFunc(&outputKey, kernelBlind) + if err != nil { + return nil, nil, err + } + + txBody := &wire.MwebTxBody{ + Inputs: inputs, + Outputs: outputs, + Kernels: []*wire.MwebKernel{kernel}, + } + txBody.Sort() + return &wire.MwebTx{ + KernelOffset: kernelOffset, + StealthOffset: *stealthOffset, + TxBody: txBody, + }, newCoins, nil +} + +func createInputsAndKernel(coins []*Coin, + outputKey *mw.SecretKey, kernelBlind *mw.BlindingFactor, + fee, pegin uint64, pegouts []*wire.TxOut, randFunc RandFunc) ( + inputs []*wire.MwebInput, kernel *wire.MwebKernel, + stealthOffset *mw.BlindingFactor, err error) { + + var inputKey, ephemeralKey mw.SecretKey + for _, coin := range coins { + if err := randFunc(ephemeralKey[:]); err != nil { + panic(err) + } + inputs = append(inputs, CreateInput(coin, &ephemeralKey)) + inputKey = *inputKey.Add(&ephemeralKey).Sub(coin.SpendKey) + } + + var stealthBlind mw.BlindingFactor + if err = randFunc(stealthBlind[:]); err != nil { + return + } + kernel = CreateKernel(kernelBlind, &stealthBlind, &fee, &pegin, pegouts, nil) + stealthOffset = (*mw.BlindingFactor)(outputKey.Add(&inputKey)).Sub(&stealthBlind) + return +} + +// Creates a standard input with a stealth key (feature bit = 1) +func CreateInput(coin *Coin, inputKey *mw.SecretKey) *wire.MwebInput { + features := wire.MwebInputStealthKeyFeatureBit + inputPubKey := inputKey.PubKey() + outputPubKey := coin.SpendKey.PubKey() + + // Hash keys (K_i||K_o) + h := blake3.New(32, nil) + h.Write(inputPubKey[:]) + h.Write(outputPubKey[:]) + keyHash := (*mw.SecretKey)(h.Sum(nil)) + + // Calculate aggregated key k_agg = k_i + HASH(K_i||K_o) * k_o + sigKey := coin.SpendKey.Mul(keyHash).Add(inputKey) + + // Hash message + h = blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, features) + h.Write(coin.OutputId[:]) + msgHash := h.Sum(nil) + + return &wire.MwebInput{ + Features: features, + OutputId: *coin.OutputId, + Commitment: *mw.SwitchCommit(coin.Blind, coin.Value), + InputPubKey: inputPubKey, + OutputPubKey: *outputPubKey, + Signature: mw.Sign(sigKey, msgHash), + } +} + +type Recipient struct { + Value uint64 + Address *mw.StealthAddress +} + +func createOutputs(recipients []*Recipient, randFunc RandFunc) ( + outputs []*wire.MwebOutput, coins []*Coin, + totalBlind mw.BlindingFactor, totalKey mw.SecretKey) { + + var ephemeralKey mw.SecretKey + + for _, recipient := range recipients { + if err := randFunc(ephemeralKey[:]); err != nil { + panic(err) + } + output, blind, shared := CreateOutput(recipient, &ephemeralKey) + SignOutput(output, recipient.Value, blind, &ephemeralKey) + totalBlind = *totalBlind.Add(mw.BlindSwitch(blind, recipient.Value)) + totalKey = *totalKey.Add(&ephemeralKey) + outputs = append(outputs, output) + + coins = append(coins, &Coin{ + Blind: blind, + Value: recipient.Value, + OutputId: output.Hash(), + SenderKey: &ephemeralKey, + Address: recipient.Address, + SharedSecret: shared, + }) + } + return +} + +func CreateOutput(recipient *Recipient, senderKey *mw.SecretKey) ( + *wire.MwebOutput, *mw.BlindingFactor, *mw.SecretKey) { + + // We only support standard feature fields for now + features := wire.MwebOutputMessageStandardFieldsFeatureBit + + // Generate 128-bit secret nonce 'n' = Hash128(T_nonce, sender_privkey) + n := new(big.Int).SetBytes(mw.Hashed(mw.HashTagNonce, senderKey[:])[:16]) + + // Calculate unique sending key 's' = H(T_send, A, B, v, n) + h := blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, mw.HashTagSendKey) + h.Write(recipient.Address.A()[:]) + h.Write(recipient.Address.B()[:]) + binary.Write(h, binary.LittleEndian, recipient.Value) + h.Write(n.FillBytes(make([]byte, 16))) + s := (*mw.SecretKey)(h.Sum(nil)) + + // Derive shared secret 't' = H(T_derive, s*A) + sA := recipient.Address.A().Mul(s) + t := (*mw.SecretKey)(mw.Hashed(mw.HashTagDerive, sA[:])) + + // Construct one-time public key for receiver 'Ko' = H(T_outkey, t)*B + Ko := recipient.Address.B().Mul((*mw.SecretKey)(mw.Hashed(mw.HashTagOutKey, t[:]))) + + // Key exchange public key 'Ke' = s*B + Ke := recipient.Address.B().Mul(s) + + // Calc blinding factor and mask nonce and amount + mask := mw.OutputMaskFromShared(t) + blind := mw.BlindSwitch(mask.Blind, recipient.Value) + mv := mask.MaskValue(recipient.Value) + mn := mask.MaskNonce(n) + + // Commitment 'C' = r*G + v*H + outputCommit := mw.NewCommitment(blind, recipient.Value) + + // Calculate the ephemeral send pubkey 'Ks' = ks*G + Ks := senderKey.PubKey() + + // Derive view tag as first byte of H(T_tag, sA) + viewTag := mw.Hashed(mw.HashTagTag, sA[:])[0] + + return &wire.MwebOutput{ + Commitment: *outputCommit, + SenderPubKey: *Ks, + ReceiverPubKey: *Ko, + Message: wire.MwebOutputMessage{ + Features: features, + KeyExchangePubKey: *Ke, + ViewTag: viewTag, + MaskedValue: mv, + MaskedNonce: *mn, + }, + }, mask.Blind, t +} + +func SignOutput(output *wire.MwebOutput, value uint64, + blind *mw.BlindingFactor, senderKey *mw.SecretKey) { + + var messageBuf bytes.Buffer + output.Message.Serialize(&messageBuf) + + rangeProof := secp256k1.NewRangeProof( + value, *mw.BlindSwitch(blind, value), + make([]byte, 20), messageBuf.Bytes()) + output.RangeProof = &rangeProof + output.RangeProofHash = blake3.Sum256(rangeProof[:]) + + h := blake3.New(32, nil) + h.Write(output.Commitment[:]) + h.Write(output.SenderPubKey[:]) + h.Write(output.ReceiverPubKey[:]) + h.Write(output.Message.Hash()[:]) + h.Write(output.RangeProofHash[:]) + output.Signature = mw.Sign(senderKey, h.Sum(nil)) +} + +func CreateKernel(blind, stealthBlind *mw.BlindingFactor, + fee, pegin *uint64, pegouts []*wire.TxOut, + lockHeight *int32) *wire.MwebKernel { + + k := &wire.MwebKernel{Excess: *mw.NewCommitment(blind, 0)} + sigKey := (*mw.SecretKey)(blind) + + if fee != nil { + k.Features |= wire.MwebKernelFeeFeatureBit + k.Fee = *fee + } + if pegin != nil && *pegin > 0 { + k.Features |= wire.MwebKernelPeginFeatureBit + k.Pegin = *pegin + } + if len(pegouts) > 0 { + k.Features |= wire.MwebKernelPegoutFeatureBit + k.Pegouts = pegouts + } + if lockHeight != nil { + k.Features |= wire.MwebKernelHeightLockFeatureBit + k.LockHeight = *lockHeight + } + if stealthBlind != nil { + k.Features |= wire.MwebKernelStealthExcessFeatureBit + k.StealthExcess = *(*mw.SecretKey)(stealthBlind).PubKey() + + h := blake3.New(32, nil) + h.Write(k.Excess.PubKey()[:]) + h.Write(k.StealthExcess[:]) + + sigKey = sigKey.Mul((*mw.SecretKey)(h.Sum(nil))). + Add((*mw.SecretKey)(stealthBlind)) + } + + k.Signature = mw.Sign(sigKey, k.MessageHash()[:]) + return k +} + +func NewPegin(value uint64, kernel *wire.MwebKernel) *wire.TxOut { + script, _ := txscript.NewScriptBuilder(). + AddOp(txscript.MwebPeginWitnessVersion + txscript.OP_1 - 1). + AddData(kernel.Hash()[:]).Script() + return wire.NewTxOut(int64(value), script) +} diff --git a/ltcutil/mweb/utxos.go b/ltcutil/mweb/utxos.go new file mode 100644 index 0000000000..19bb4ac192 --- /dev/null +++ b/ltcutil/mweb/utxos.go @@ -0,0 +1,239 @@ +package mweb + +import ( + "encoding/binary" + "math/bits" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" + "lukechampine.com/blake3" +) + +type ( + leafIdx uint64 + nodeIdx uint64 +) + +func (l *Leafset) contains(i leafIdx) bool { + return l.Contains(uint64(i)) +} + +func (l *Leafset) nextUnspent(i leafIdx) leafIdx { + for { + i++ + if l.contains(i) || uint64(i) >= l.Size { + return i + } + } +} + +func (i leafIdx) nodeIdx() nodeIdx { + return nodeIdx(2*i) - nodeIdx(bits.OnesCount64(uint64(i))) +} + +func (i nodeIdx) height() uint64 { + height := uint64(i) + h := 64 - bits.LeadingZeros64(uint64(i)) + for peakSize := uint64(1< 0; peakSize >>= 1 { + if height >= peakSize { + height -= peakSize + } + } + return height +} + +func (i nodeIdx) leafIdx() leafIdx { + leafIndex := uint64(0) + numLeft := uint64(i) + h := 64 - bits.LeadingZeros64(uint64(i)) + for peakSize := uint64(1< 0; peakSize >>= 1 { + if numLeft >= peakSize { + leafIndex += (peakSize + 1) / 2 + numLeft -= peakSize + } + } + return leafIdx(leafIndex) +} + +func (i nodeIdx) left(height uint64) nodeIdx { + return i - (1 << height) +} + +func (i nodeIdx) right() nodeIdx { + return i - 1 +} + +func (i nodeIdx) hash(data []byte) *chainhash.Hash { + h := blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, uint64(i)) + wire.WriteVarBytes(h, 0, data) + return (*chainhash.Hash)(h.Sum(nil)) +} + +func (i nodeIdx) parentHash(left, right []byte) *chainhash.Hash { + h := blake3.New(32, nil) + binary.Write(h, binary.LittleEndian, uint64(i)) + h.Write(left) + h.Write(right) + return (*chainhash.Hash)(h.Sum(nil)) +} + +func calcPeaks(nodes uint64) (peaks []nodeIdx) { + sumPrevPeaks := uint64(0) + h := 64 - bits.LeadingZeros64(nodes) + for peakSize := uint64(1< 0; peakSize >>= 1 { + if nodes >= peakSize { + peaks = append(peaks, nodeIdx(sumPrevPeaks+peakSize-1)) + sumPrevPeaks += peakSize + nodes -= peakSize + } + } + return +} + +type verifyUtxosVars struct { + mwebUtxos *wire.MsgMwebUtxos + leafset *Leafset + firstLeafIdx, lastLeafIdx leafIdx + leavesUsed, hashesUsed int + isProofHash map[nodeIdx]bool +} + +func (v *verifyUtxosVars) nextLeaf() ( + leafIndex leafIdx, hash *chainhash.Hash) { + + if v.leavesUsed == len(v.mwebUtxos.Utxos) { + return + } + utxo := v.mwebUtxos.Utxos[v.leavesUsed] + leafIndex = leafIdx(utxo.LeafIndex) + hash = utxo.OutputId + v.leavesUsed++ + return +} + +func (v *verifyUtxosVars) nextHash( + nodeIdx nodeIdx) (hash *chainhash.Hash) { + + if v.hashesUsed == len(v.mwebUtxos.ProofHashes) { + return + } + hash = v.mwebUtxos.ProofHashes[v.hashesUsed] + v.hashesUsed++ + v.isProofHash[nodeIdx] = true + return +} + +func (v *verifyUtxosVars) calcNodeHash( + nodeIdx nodeIdx, height uint64) *chainhash.Hash { + + if nodeIdx < v.firstLeafIdx.nodeIdx() || v.isProofHash[nodeIdx] { + return v.nextHash(nodeIdx) + } + if height == 0 { + leafIdx := nodeIdx.leafIdx() + if !v.leafset.contains(leafIdx) { + return nil + } + leafIdx2, outputId := v.nextLeaf() + if leafIdx != leafIdx2 || outputId == nil { + return nil + } + return nodeIdx.hash(outputId[:]) + } + left := v.calcNodeHash(nodeIdx.left(height), height-1) + var right *chainhash.Hash + if v.lastLeafIdx.nodeIdx() <= nodeIdx.left(height) { + right = v.nextHash(nodeIdx.right()) + } else { + right = v.calcNodeHash(nodeIdx.right(), height-1) + } + switch { + case left == nil && right == nil: + return nil + case left == nil: + if left = v.nextHash(nodeIdx.left(height)); left == nil { + return nil + } + case right == nil: + if right = v.nextHash(nodeIdx.right()); right == nil { + return nil + } + } + return nodeIdx.parentHash(left[:], right[:]) +} + +func VerifyUtxos(mwebHeader *wire.MwebHeader, + leafset *Leafset, mwebUtxos *wire.MsgMwebUtxos) bool { + + if mwebUtxos.StartIndex == 0 && len(mwebUtxos.Utxos) == 0 && + len(mwebUtxos.ProofHashes) == 0 && leafset.Size == 0 && + mwebHeader.OutputRoot.IsEqual(&chainhash.Hash{}) { + return true + } else if len(mwebUtxos.Utxos) == 0 || leafset.Size == 0 { + return false + } + + v := &verifyUtxosVars{ + mwebUtxos: mwebUtxos, + leafset: leafset, + firstLeafIdx: leafIdx(mwebUtxos.StartIndex), + lastLeafIdx: leafIdx(mwebUtxos.StartIndex), + isProofHash: make(map[nodeIdx]bool), + } + + for i := 0; ; i++ { + if !v.leafset.contains(v.lastLeafIdx) { + return false + } + if leafIdx(mwebUtxos.Utxos[i].LeafIndex) != v.lastLeafIdx { + return false + } + if i == len(mwebUtxos.Utxos)-1 { + break + } + v.lastLeafIdx = v.leafset.nextUnspent(v.lastLeafIdx) + } + + var ( + nextNodeIdx = leafIdx(leafset.Size).nodeIdx() + peaks = calcPeaks(uint64(nextNodeIdx)) + peakHashes []*chainhash.Hash + ) + for i := 0; i < 2; i++ { + peakHashes = nil + v.leavesUsed = 0 + v.hashesUsed = 0 + + for _, peakNodeIdx := range peaks { + peakHash := v.calcNodeHash(peakNodeIdx, peakNodeIdx.height()) + if peakHash == nil { + peakHash = v.nextHash(peakNodeIdx) + if peakHash == nil { + return false + } + } + peakHashes = append(peakHashes, peakHash) + if v.lastLeafIdx.nodeIdx() <= peakNodeIdx { + if peakNodeIdx != peaks[len(peaks)-1] { + baggedPeak := v.nextHash(nextNodeIdx) + if baggedPeak == nil { + return false + } + peakHashes = append(peakHashes, baggedPeak) + } + break + } + } + if v.leavesUsed != len(v.mwebUtxos.Utxos) || + v.hashesUsed != len(v.mwebUtxos.ProofHashes) { + return false + } + } + + baggedPeak := peakHashes[len(peakHashes)-1] + for i := len(peakHashes) - 2; i >= 0; i-- { + baggedPeak = nextNodeIdx.parentHash(peakHashes[i][:], baggedPeak[:]) + } + return baggedPeak.IsEqual(&mwebHeader.OutputRoot) +} diff --git a/ltcutil/psbt/creator.go b/ltcutil/psbt/creator.go index 5b14f558d6..f1c9ee9773 100644 --- a/ltcutil/psbt/creator.go +++ b/ltcutil/psbt/creator.go @@ -5,7 +5,7 @@ package psbt import ( - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // MinTxVersion is the lowest transaction version that we'll permit. diff --git a/ltcutil/psbt/extractor.go b/ltcutil/psbt/extractor.go index 7c9ccbbf46..e02395bc0d 100644 --- a/ltcutil/psbt/extractor.go +++ b/ltcutil/psbt/extractor.go @@ -12,8 +12,8 @@ package psbt import ( "bytes" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // Extract takes a finalized psbt.Packet and outputs a finalized transaction diff --git a/ltcutil/psbt/finalizer.go b/ltcutil/psbt/finalizer.go index da8f13e1a2..65297ab747 100644 --- a/ltcutil/psbt/finalizer.go +++ b/ltcutil/psbt/finalizer.go @@ -15,9 +15,9 @@ import ( "bytes" "fmt" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // isFinalized considers this input finalized if it contains at least one of diff --git a/ltcutil/psbt/go.mod b/ltcutil/psbt/go.mod deleted file mode 100644 index 44958cebd3..0000000000 --- a/ltcutil/psbt/go.mod +++ /dev/null @@ -1,24 +0,0 @@ -module github.com/ltcsuite/ltcd/ltcutil/psbt - -go 1.17 - -require ( - github.com/davecgh/go-spew v1.1.1 - github.com/ltcsuite/ltcd v0.23.5 - github.com/ltcsuite/ltcd/btcec/v2 v2.3.2 - github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 - github.com/ltcsuite/ltcd/ltcutil v1.1.3 - github.com/stretchr/testify v1.8.0 -) - -require ( - github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect - github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect - golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/blake3 v1.2.1 // indirect -) diff --git a/ltcutil/psbt/go.sum b/ltcutil/psbt/go.sum deleted file mode 100644 index 1e5f26081c..0000000000 --- a/ltcutil/psbt/go.sum +++ /dev/null @@ -1,105 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/ltcsuite/ltcd v0.23.5 h1:MFWjmx2hCwxrUu9v0wdIPOSN7PHg9BWQeh+AO4FsVLI= -github.com/ltcsuite/ltcd v0.23.5/go.mod h1:JV6swXR5m0cYFi0VYdQPp3UnMdaDQxaRUCaU1PPjb+g= -github.com/ltcsuite/ltcd/btcec/v2 v2.3.2 h1:HVArUNQGqGaSSoyYkk9qGht74U0/uNhS0n7jV9rkmno= -github.com/ltcsuite/ltcd/btcec/v2 v2.3.2/go.mod h1:T1t5TjbjPnryvlGQ+RpSKGuU8KhjNN7rS5+IznPj1VM= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2 h1:xuWxvRKxLvOKuS7/Q/7I3tpc3cWAB0+hZpU8YdVqkzg= -github.com/ltcsuite/ltcd/chaincfg/chainhash v1.0.2/go.mod h1:nkLkAFGhursWf2U68gt61hPieK1I+0m78e+2aevNyD8= -github.com/ltcsuite/ltcd/ltcutil v1.1.3 h1:8AapjCPLIt/wtYe6Odfk1EC2y9mcbpgjyxyCoNjAkFI= -github.com/ltcsuite/ltcd/ltcutil v1.1.3/go.mod h1:z8txd/ohBFrOMBUT70K8iZvHJD/Vc3gzx+6BP6cBxQw= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= -lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= diff --git a/ltcutil/psbt/partial_input.go b/ltcutil/psbt/partial_input.go index d45954326a..44aca7567c 100644 --- a/ltcutil/psbt/partial_input.go +++ b/ltcutil/psbt/partial_input.go @@ -6,8 +6,8 @@ import ( "io" "sort" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // PInput is a struct encapsulating all the data that can be attached to any diff --git a/ltcutil/psbt/partial_output.go b/ltcutil/psbt/partial_output.go index 565a0b9945..4b2059762d 100644 --- a/ltcutil/psbt/partial_output.go +++ b/ltcutil/psbt/partial_output.go @@ -5,7 +5,7 @@ import ( "io" "sort" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // POutput is a struct encapsulating all the data that can be attached diff --git a/ltcutil/psbt/partialsig.go b/ltcutil/psbt/partialsig.go index 33d6975562..1c6726cba2 100644 --- a/ltcutil/psbt/partialsig.go +++ b/ltcutil/psbt/partialsig.go @@ -3,8 +3,8 @@ package psbt import ( "bytes" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" ) // PartialSig encapsulate a (BTC public key, ECDSA signature) diff --git a/ltcutil/psbt/psbt.go b/ltcutil/psbt/psbt.go index cbff8616c2..80fcb04c89 100644 --- a/ltcutil/psbt/psbt.go +++ b/ltcutil/psbt/psbt.go @@ -13,8 +13,8 @@ import ( "errors" "io" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // psbtMagicLength is the length of the magic bytes used to signal the start of diff --git a/ltcutil/psbt/psbt_test.go b/ltcutil/psbt/psbt_test.go index 1c1166c802..e70dab5ed1 100644 --- a/ltcutil/psbt/psbt_test.go +++ b/ltcutil/psbt/psbt_test.go @@ -13,10 +13,10 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" "github.com/stretchr/testify/require" ) diff --git a/ltcutil/psbt/signer.go b/ltcutil/psbt/signer.go index 4e938363ed..e0bedadade 100644 --- a/ltcutil/psbt/signer.go +++ b/ltcutil/psbt/signer.go @@ -10,7 +10,7 @@ package psbt // is in the correct state. import ( - "github.com/ltcsuite/ltcd/txscript" + "github.com/ltcmweb/ltcd/txscript" ) // SignOutcome is a enum-like value that expresses the outcome of a call to the diff --git a/ltcutil/psbt/sort.go b/ltcutil/psbt/sort.go index 93beb5a0fc..7787738af2 100644 --- a/ltcutil/psbt/sort.go +++ b/ltcutil/psbt/sort.go @@ -4,7 +4,7 @@ import ( "bytes" "sort" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // InPlaceSort modifies the passed packet's wire TX inputs and outputs to be diff --git a/ltcutil/psbt/sort_test.go b/ltcutil/psbt/sort_test.go index 2d52c5073c..afaefb7f52 100644 --- a/ltcutil/psbt/sort_test.go +++ b/ltcutil/psbt/sort_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) func TestInPlaceSort(t *testing.T) { diff --git a/ltcutil/psbt/taproot.go b/ltcutil/psbt/taproot.go index 740c5eb445..7f69118a5e 100644 --- a/ltcutil/psbt/taproot.go +++ b/ltcutil/psbt/taproot.go @@ -3,9 +3,9 @@ package psbt import ( "bytes" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/ltcutil/psbt/updater.go b/ltcutil/psbt/updater.go index 9dd10313bc..91d1991e9b 100644 --- a/ltcutil/psbt/updater.go +++ b/ltcutil/psbt/updater.go @@ -14,9 +14,9 @@ import ( "bytes" "crypto/sha256" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // Updater encapsulates the role 'Updater' as specified in BIP174; it accepts diff --git a/ltcutil/psbt/utils.go b/ltcutil/psbt/utils.go index faff85d4b0..8a662155f3 100644 --- a/ltcutil/psbt/utils.go +++ b/ltcutil/psbt/utils.go @@ -12,8 +12,8 @@ import ( "io" "sort" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // WriteTxWitness is a utility function due to non-exported witness diff --git a/ltcutil/psbt/utils_test.go b/ltcutil/psbt/utils_test.go index 67b3fcf90e..5f6de7c8b6 100644 --- a/ltcutil/psbt/utils_test.go +++ b/ltcutil/psbt/utils_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) func TestSumUtxoInputValues(t *testing.T) { diff --git a/ltcutil/scrypt/scrypt.c b/ltcutil/scrypt/scrypt.c new file mode 100644 index 0000000000..16a011bbf7 --- /dev/null +++ b/ltcutil/scrypt/scrypt.c @@ -0,0 +1,91 @@ +#include +#include + +#define ROTL(a, b) (((a) << (b)) | ((a) >> (32 - (b)))) + +static inline void xor_salsa8(uint32_t B[16], const uint32_t Bx[16]) +{ + uint32_t x00,x01,x02,x03,x04,x05,x06,x07,x08,x09,x10,x11,x12,x13,x14,x15; + int i; + + x00 = (B[ 0] ^= Bx[ 0]); + x01 = (B[ 1] ^= Bx[ 1]); + x02 = (B[ 2] ^= Bx[ 2]); + x03 = (B[ 3] ^= Bx[ 3]); + x04 = (B[ 4] ^= Bx[ 4]); + x05 = (B[ 5] ^= Bx[ 5]); + x06 = (B[ 6] ^= Bx[ 6]); + x07 = (B[ 7] ^= Bx[ 7]); + x08 = (B[ 8] ^= Bx[ 8]); + x09 = (B[ 9] ^= Bx[ 9]); + x10 = (B[10] ^= Bx[10]); + x11 = (B[11] ^= Bx[11]); + x12 = (B[12] ^= Bx[12]); + x13 = (B[13] ^= Bx[13]); + x14 = (B[14] ^= Bx[14]); + x15 = (B[15] ^= Bx[15]); + + for (i = 0; i < 8; i += 2) { + /* Operate on columns. */ + x04 ^= ROTL(x00 + x12, 7); x09 ^= ROTL(x05 + x01, 7); + x14 ^= ROTL(x10 + x06, 7); x03 ^= ROTL(x15 + x11, 7); + + x08 ^= ROTL(x04 + x00, 9); x13 ^= ROTL(x09 + x05, 9); + x02 ^= ROTL(x14 + x10, 9); x07 ^= ROTL(x03 + x15, 9); + + x12 ^= ROTL(x08 + x04, 13); x01 ^= ROTL(x13 + x09, 13); + x06 ^= ROTL(x02 + x14, 13); x11 ^= ROTL(x07 + x03, 13); + + x00 ^= ROTL(x12 + x08, 18); x05 ^= ROTL(x01 + x13, 18); + x10 ^= ROTL(x06 + x02, 18); x15 ^= ROTL(x11 + x07, 18); + + /* Operate on rows. */ + x01 ^= ROTL(x00 + x03, 7); x06 ^= ROTL(x05 + x04, 7); + x11 ^= ROTL(x10 + x09, 7); x12 ^= ROTL(x15 + x14, 7); + + x02 ^= ROTL(x01 + x00, 9); x07 ^= ROTL(x06 + x05, 9); + x08 ^= ROTL(x11 + x10, 9); x13 ^= ROTL(x12 + x15, 9); + + x03 ^= ROTL(x02 + x01, 13); x04 ^= ROTL(x07 + x06, 13); + x09 ^= ROTL(x08 + x11, 13); x14 ^= ROTL(x13 + x12, 13); + + x00 ^= ROTL(x03 + x02, 18); x05 ^= ROTL(x04 + x07, 18); + x10 ^= ROTL(x09 + x08, 18); x15 ^= ROTL(x14 + x13, 18); + } + + B[ 0] += x00; + B[ 1] += x01; + B[ 2] += x02; + B[ 3] += x03; + B[ 4] += x04; + B[ 5] += x05; + B[ 6] += x06; + B[ 7] += x07; + B[ 8] += x08; + B[ 9] += x09; + B[10] += x10; + B[11] += x11; + B[12] += x12; + B[13] += x13; + B[14] += x14; + B[15] += x15; +} + +void scrypt_aux(uint32_t X[32]) +{ + uint32_t V[32768], i, j, k; + + for (i = 0; i < 1024; i++) { + memcpy(&V[i * 32], X, 128); + xor_salsa8(&X[0], &X[16]); + xor_salsa8(&X[16], &X[0]); + } + + for (i = 0; i < 1024; i++) { + j = 32 * (X[16] & 1023); + for (k = 0; k < 32; k++) + X[k] ^= V[j + k]; + xor_salsa8(&X[0], &X[16]); + xor_salsa8(&X[16], &X[0]); + } +} diff --git a/ltcutil/scrypt/scrypt.go b/ltcutil/scrypt/scrypt.go new file mode 100644 index 0000000000..f2e780a798 --- /dev/null +++ b/ltcutil/scrypt/scrypt.go @@ -0,0 +1,16 @@ +package scrypt + +// void scrypt_aux(unsigned char*); +import "C" + +import ( + "crypto/sha256" + + "golang.org/x/crypto/pbkdf2" +) + +func Scrypt(x []byte) []byte { + X := pbkdf2.Key(x, x, 1, 128, sha256.New) + C.scrypt_aux((*C.uchar)(&X[0])) + return pbkdf2.Key(x, X, 1, 32, sha256.New) +} diff --git a/ltcutil/tx.go b/ltcutil/tx.go index df984211cf..f74995e30d 100644 --- a/ltcutil/tx.go +++ b/ltcutil/tx.go @@ -8,8 +8,8 @@ import ( "bytes" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // TxIndexUnknown is the value returned for a transaction index that is unknown. diff --git a/ltcutil/tx_test.go b/ltcutil/tx_test.go index c23c561b03..3ecbfda853 100644 --- a/ltcutil/tx_test.go +++ b/ltcutil/tx_test.go @@ -11,8 +11,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" ) // TestTx tests the API for Tx. diff --git a/ltcutil/txsort/README.md b/ltcutil/txsort/README.md index d43fb40791..932b3ed990 100644 --- a/ltcutil/txsort/README.md +++ b/ltcutil/txsort/README.md @@ -22,7 +22,7 @@ A comprehensive suite of tests is provided to ensure proper functionality. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/ltcutil/txsort +$ go get -u github.com/ltcmweb/ltcd/ltcutil/txsort ``` ## License diff --git a/ltcutil/txsort/txsort.go b/ltcutil/txsort/txsort.go index c1573e1848..0832dde4b7 100644 --- a/ltcutil/txsort/txsort.go +++ b/ltcutil/txsort/txsort.go @@ -11,8 +11,8 @@ import ( "bytes" "sort" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // InPlaceSort modifies the passed transaction inputs and outputs to be sorted diff --git a/ltcutil/txsort/txsort_test.go b/ltcutil/txsort/txsort_test.go index b6a763aeaf..39d5458c90 100644 --- a/ltcutil/txsort/txsort_test.go +++ b/ltcutil/txsort/txsort_test.go @@ -11,8 +11,8 @@ import ( "path/filepath" "testing" - "github.com/ltcsuite/ltcd/ltcutil/txsort" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil/txsort" + "github.com/ltcmweb/ltcd/wire" ) // TestSort ensures the transaction sorting works according to the BIP. diff --git a/ltcutil/wif.go b/ltcutil/wif.go index 0dbc4a147b..9896a9c873 100644 --- a/ltcutil/wif.go +++ b/ltcutil/wif.go @@ -8,10 +8,10 @@ import ( "bytes" "errors" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil/base58" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/base58" ) // ErrMalformedPrivateKey describes an error where a WIF-encoded private diff --git a/ltcutil/wif_test.go b/ltcutil/wif_test.go index ddbbe13d3c..eed1b1c7b5 100644 --- a/ltcutil/wif_test.go +++ b/ltcutil/wif_test.go @@ -9,9 +9,9 @@ import ( "encoding/hex" "testing" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - . "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + . "github.com/ltcmweb/ltcd/ltcutil" ) func TestEncodeDecodeWIF(t *testing.T) { diff --git a/mempool/README.md b/mempool/README.md index 20310bd2c4..495bddd74c 100644 --- a/mempool/README.md +++ b/mempool/README.md @@ -74,7 +74,7 @@ be an exhaustive list. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/mempool +$ go get -u github.com/ltcmweb/ltcd/mempool ``` ## License diff --git a/mempool/error.go b/mempool/error.go index f779f072f0..9445280bf3 100644 --- a/mempool/error.go +++ b/mempool/error.go @@ -5,8 +5,8 @@ package mempool import ( - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/wire" ) // RuleError identifies a rule violation. It is used to indicate that diff --git a/mempool/estimatefee.go b/mempool/estimatefee.go index 35b8825ad9..a808b9c0ac 100644 --- a/mempool/estimatefee.go +++ b/mempool/estimatefee.go @@ -16,9 +16,9 @@ import ( "strings" "sync" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mining" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mining" ) // TODO incorporate Alex Morcos' modifications to Gavin's initial model diff --git a/mempool/estimatefee_test.go b/mempool/estimatefee_test.go index b8abb493ce..52a8092f60 100644 --- a/mempool/estimatefee_test.go +++ b/mempool/estimatefee_test.go @@ -9,10 +9,10 @@ import ( "math/rand" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/wire" ) // newTestFeeEstimator creates a feeEstimator with some different parameters diff --git a/mempool/mempool.go b/mempool/mempool.go index 91f056b844..043ad2656d 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -12,15 +12,15 @@ import ( "sync/atomic" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/mempool/mempool_test.go b/mempool/mempool_test.go index 43a47a2610..7b38c95db5 100644 --- a/mempool/mempool_test.go +++ b/mempool/mempool_test.go @@ -12,13 +12,13 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // fakeChain is used by the pool harness to provide generated test utxos and diff --git a/mempool/policy.go b/mempool/policy.go index c99f8d9178..fed0473a33 100644 --- a/mempool/policy.go +++ b/mempool/policy.go @@ -8,10 +8,10 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/mempool/policy_test.go b/mempool/policy_test.go index 91dd7136ce..271e47dc76 100644 --- a/mempool/policy_test.go +++ b/mempool/policy_test.go @@ -9,12 +9,12 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // TestCalcMinRequiredTxRelayFee tests the calcMinRequiredTxRelayFee API. diff --git a/mining/README.md b/mining/README.md index 6bd0213987..09152d091e 100644 --- a/mining/README.md +++ b/mining/README.md @@ -12,7 +12,7 @@ This package is currently a work in progress. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/mining +$ go get -u github.com/ltcmweb/ltcd/mining ``` ## License diff --git a/mining/cpuminer/README.md b/mining/cpuminer/README.md index c96c18d96b..12b9330de7 100644 --- a/mining/cpuminer/README.md +++ b/mining/cpuminer/README.md @@ -16,7 +16,7 @@ now. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/mining/cpuminer +$ go get -u github.com/ltcmweb/ltcd/mining/cpuminer ``` ## License diff --git a/mining/cpuminer/cpuminer.go b/mining/cpuminer/cpuminer.go index fa27d5db0d..517cfa748e 100644 --- a/mining/cpuminer/cpuminer.go +++ b/mining/cpuminer/cpuminer.go @@ -12,12 +12,12 @@ import ( "sync" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/mining/mining.go b/mining/mining.go index 2a631d1936..6337ead509 100644 --- a/mining/mining.go +++ b/mining/mining.go @@ -10,12 +10,12 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/mining/mining_test.go b/mining/mining_test.go index f7f6a4817a..5b79bb9477 100644 --- a/mining/mining_test.go +++ b/mining/mining_test.go @@ -9,7 +9,7 @@ import ( "math/rand" "testing" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) // TestTxFeePrioHeap ensures the priority queue for transaction fees and diff --git a/mining/policy.go b/mining/policy.go index 6d28a15578..57886d8c84 100644 --- a/mining/policy.go +++ b/mining/policy.go @@ -5,9 +5,9 @@ package mining import ( - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/mining/policy_test.go b/mining/policy_test.go index 2a9a299493..5450b75b31 100644 --- a/mining/policy_test.go +++ b/mining/policy_test.go @@ -8,10 +8,10 @@ import ( "encoding/hex" "testing" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // newHashFromStr converts the passed big-endian hex string into a diff --git a/netsync/README.md b/netsync/README.md index 84b51e88e3..b083346845 100644 --- a/netsync/README.md +++ b/netsync/README.md @@ -17,7 +17,7 @@ longest chain the sync peer is aware of. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/netsync +$ go get -u github.com/ltcmweb/ltcd/netsync ``` ## License diff --git a/netsync/blocklogger.go b/netsync/blocklogger.go index 1b69a70344..3bb5803610 100644 --- a/netsync/blocklogger.go +++ b/netsync/blocklogger.go @@ -9,7 +9,7 @@ import ( "time" "github.com/btcsuite/btclog" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil" ) // blockProgressLogger provides periodic logging for other services in order diff --git a/netsync/interface.go b/netsync/interface.go index e62ed3276e..b21f1f50d6 100644 --- a/netsync/interface.go +++ b/netsync/interface.go @@ -5,13 +5,13 @@ package netsync import ( - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mempool" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mempool" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/wire" ) // PeerNotifier exposes methods to notify peers of status changes to diff --git a/netsync/manager.go b/netsync/manager.go index 0e400d275c..f5ffc22fda 100644 --- a/netsync/manager.go +++ b/netsync/manager.go @@ -12,14 +12,14 @@ import ( "sync/atomic" "time" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mempool" - peerpkg "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mempool" + peerpkg "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/params.go b/params.go index 0902bcc47c..25dace23f2 100644 --- a/params.go +++ b/params.go @@ -5,8 +5,8 @@ package main import ( - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/wire" ) // activeNetParams is a pointer to the parameters specific to the diff --git a/peer/README.md b/peer/README.md index 9cc7dcc140..7df64c1428 100644 --- a/peer/README.md +++ b/peer/README.md @@ -58,7 +58,7 @@ A quick overview of the major features peer provides are as follows: ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/peer +$ go get -u github.com/ltcmweb/ltcd/peer ``` ## Examples diff --git a/peer/example_test.go b/peer/example_test.go index aaa455bd57..5347b8207a 100644 --- a/peer/example_test.go +++ b/peer/example_test.go @@ -10,9 +10,9 @@ import ( "net" "time" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/wire" ) // mockRemotePeer creates a basic inbound peer listening on the simnet port for diff --git a/peer/log.go b/peer/log.go index 276c2483a3..23d87b196b 100644 --- a/peer/log.go +++ b/peer/log.go @@ -9,10 +9,10 @@ import ( "strings" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" "github.com/btcsuite/btclog" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( @@ -93,10 +93,14 @@ func invSummary(invList []*wire.InvVect) string { return fmt.Sprintf("error %s", iv.Hash) case wire.InvTypeWitnessBlock: return fmt.Sprintf("witness block %s", iv.Hash) + case wire.InvTypeMwebBlock: + return fmt.Sprintf("mweb block %s", iv.Hash) case wire.InvTypeBlock: return fmt.Sprintf("block %s", iv.Hash) case wire.InvTypeWitnessTx: return fmt.Sprintf("witness tx %s", iv.Hash) + case wire.InvTypeMwebTx: + return fmt.Sprintf("mweb tx %s", iv.Hash) case wire.InvTypeTx: return fmt.Sprintf("tx %s", iv.Hash) } diff --git a/peer/peer.go b/peer/peer.go index b6c1fe2150..efd154eecd 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -21,10 +21,10 @@ import ( "github.com/btcsuite/go-socks/socks" "github.com/davecgh/go-spew/spew" "github.com/decred/dcrd/lru" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) const ( @@ -203,6 +203,15 @@ type MessageListeners struct { // OnSendAddrV2 is invoked when a peer receives a sendaddrv2 message. OnSendAddrV2 func(p *Peer, msg *wire.MsgSendAddrV2) + // OnMwebHeader is invoked when a peer receives a mwebheader message. + OnMwebHeader func(p *Peer, msg *wire.MsgMwebHeader) + + // OnMwebLeafset is invoked when a peer receives a mwebleafset message. + OnMwebLeafset func(p *Peer, msg *wire.MsgMwebLeafset) + + // OnMwebUtxos is invoked when a peer receives a mwebutxos message. + OnMwebUtxos func(p *Peer, msg *wire.MsgMwebUtxos) + // OnRead is invoked when a peer receives a litecoin message. It // consists of the number of bytes read, the message, and whether or not // an error in the read occurred. Typically, callers will opt to use @@ -1612,6 +1621,21 @@ out: p.cfg.Listeners.OnSendHeaders(p, msg) } + case *wire.MsgMwebHeader: + if p.cfg.Listeners.OnMwebHeader != nil { + p.cfg.Listeners.OnMwebHeader(p, msg) + } + + case *wire.MsgMwebLeafset: + if p.cfg.Listeners.OnMwebLeafset != nil { + p.cfg.Listeners.OnMwebLeafset(p, msg) + } + + case *wire.MsgMwebUtxos: + if p.cfg.Listeners.OnMwebUtxos != nil { + p.cfg.Listeners.OnMwebUtxos(p, msg) + } + default: log.Debugf("Received unhandled message of type %v "+ "from %v", rmsg.Command(), p) diff --git a/peer/peer_test.go b/peer/peer_test.go index 4ab478fca5..2193ac112b 100644 --- a/peer/peer_test.go +++ b/peer/peer_test.go @@ -14,10 +14,10 @@ import ( "time" "github.com/btcsuite/go-socks/socks" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/wire" ) // conn mocks a network connection by implementing the net.Conn interface. It diff --git a/release/release.sh b/release/release.sh index a5fef2e4e4..fd8fc1be20 100755 --- a/release/release.sh +++ b/release/release.sh @@ -72,7 +72,7 @@ SYS=${BTCDBUILDSYS:-" # Use the first element of $GOPATH in the case where GOPATH is a list # (something that is totally allowed). -PKG="github.com/ltcsuite/ltcd" +PKG="github.com/ltcmweb/ltcd" COMMIT=$(git describe --abbrev=40 --dirty --tags) for i in $SYS; do @@ -92,8 +92,8 @@ for i in $SYS; do cd $PACKAGE-$i-$TAG echo "Building:" $OS $ARCH $ARM - env CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH GOARM=$ARM go build -v -trimpath -ldflags="-s -w -buildid=" github.com/ltcsuite/ltcd - env CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH GOARM=$ARM go build -v -trimpath -ldflags="-s -w -buildid=" github.com/ltcsuite/ltcd/cmd/ltcctl + env CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH GOARM=$ARM go build -v -trimpath -ldflags="-s -w -buildid=" github.com/ltcmweb/ltcd + env CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH GOARM=$ARM go build -v -trimpath -ldflags="-s -w -buildid=" github.com/ltcmweb/ltcd/cmd/ltcctl cd .. if [[ $OS = "windows" ]]; then diff --git a/rpcadapters.go b/rpcadapters.go index c8c48b1dc8..64991dbe71 100644 --- a/rpcadapters.go +++ b/rpcadapters.go @@ -7,13 +7,13 @@ package main import ( "sync/atomic" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mempool" - "github.com/ltcsuite/ltcd/netsync" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mempool" + "github.com/ltcmweb/ltcd/netsync" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/wire" ) // rpcPeer provides a peer for use with the RPC server and implements the diff --git a/rpcclient/README.md b/rpcclient/README.md index 2eeba75266..746e67fe25 100644 --- a/rpcclient/README.md +++ b/rpcclient/README.md @@ -47,7 +47,7 @@ implement and the API is not stable yet. ## Installation ```bash -$ go get -u github.com/ltcsuite/ltcd/rpcclient +$ go get -u github.com/ltcmweb/ltcd/rpcclient ``` ## License diff --git a/rpcclient/chain.go b/rpcclient/chain.go index 840568ead3..d41bfbc59f 100644 --- a/rpcclient/chain.go +++ b/rpcclient/chain.go @@ -10,9 +10,9 @@ import ( "encoding/hex" "encoding/json" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // FutureGetBestBlockHashResult is a future promise to deliver the result of a diff --git a/rpcclient/example_test.go b/rpcclient/example_test.go index de7af53245..320db2933e 100644 --- a/rpcclient/example_test.go +++ b/rpcclient/example_test.go @@ -7,7 +7,7 @@ package rpcclient import ( "fmt" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) var connCfg = &ConnConfig{ diff --git a/rpcclient/examples/bitcoincorehttp/README.md b/rpcclient/examples/bitcoincorehttp/README.md index bf8f056256..9d906292a4 100644 --- a/rpcclient/examples/bitcoincorehttp/README.md +++ b/rpcclient/examples/bitcoincorehttp/README.md @@ -10,7 +10,7 @@ block count. The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/ltcsuite/ltcd/rpcclient +$ go get github.com/ltcmweb/ltcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and diff --git a/rpcclient/examples/bitcoincorehttp/main.go b/rpcclient/examples/bitcoincorehttp/main.go index e5fe15414e..893ee817f1 100644 --- a/rpcclient/examples/bitcoincorehttp/main.go +++ b/rpcclient/examples/bitcoincorehttp/main.go @@ -7,7 +7,7 @@ package main import ( "log" - "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/rpcclient" ) func main() { diff --git a/rpcclient/examples/bitcoincorehttpbulk/README.md b/rpcclient/examples/bitcoincorehttpbulk/README.md index f83f2bf8eb..64bc92f901 100644 --- a/rpcclient/examples/bitcoincorehttpbulk/README.md +++ b/rpcclient/examples/bitcoincorehttpbulk/README.md @@ -8,7 +8,7 @@ This example shows how to use the rpclient package to connect to a Litecoin Core The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/ltcsuite/ltcd/rpcclient +$ go get github.com/ltcmweb/ltcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and diff --git a/rpcclient/examples/bitcoincorehttpbulk/main.go b/rpcclient/examples/bitcoincorehttpbulk/main.go index 3974ae7ac5..9926d9db14 100644 --- a/rpcclient/examples/bitcoincorehttpbulk/main.go +++ b/rpcclient/examples/bitcoincorehttpbulk/main.go @@ -8,7 +8,7 @@ import ( "fmt" "log" - "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/rpcclient" ) func main() { diff --git a/rpcclient/examples/btcdwebsockets/README.md b/rpcclient/examples/btcdwebsockets/README.md index a0e1f47aaf..f5a9f3592f 100644 --- a/rpcclient/examples/btcdwebsockets/README.md +++ b/rpcclient/examples/btcdwebsockets/README.md @@ -13,7 +13,7 @@ demonstrate clean shutdown. The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/ltcsuite/ltcd/rpcclient +$ go get github.com/ltcmweb/ltcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and diff --git a/rpcclient/examples/btcdwebsockets/main.go b/rpcclient/examples/btcdwebsockets/main.go index 2973defe8d..f572a0b6fd 100644 --- a/rpcclient/examples/btcdwebsockets/main.go +++ b/rpcclient/examples/btcdwebsockets/main.go @@ -10,9 +10,9 @@ import ( "path/filepath" "time" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/rpcclient" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/wire" ) func main() { diff --git a/rpcclient/examples/btcwalletwebsockets/README.md b/rpcclient/examples/btcwalletwebsockets/README.md index 6a43ae5e90..d53e16ed7e 100644 --- a/rpcclient/examples/btcwalletwebsockets/README.md +++ b/rpcclient/examples/btcwalletwebsockets/README.md @@ -14,7 +14,7 @@ demonstrate clean shutdown. The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/ltcsuite/ltcd/rpcclient +$ go get github.com/ltcmweb/ltcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and diff --git a/rpcclient/examples/btcwalletwebsockets/main.go b/rpcclient/examples/btcwalletwebsockets/main.go index 96610be3c0..e5962fa00e 100644 --- a/rpcclient/examples/btcwalletwebsockets/main.go +++ b/rpcclient/examples/btcwalletwebsockets/main.go @@ -11,8 +11,8 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/rpcclient" ) func main() { diff --git a/rpcclient/examples/customcommand/README.md b/rpcclient/examples/customcommand/README.md index a12cb226c7..7f98f2b733 100644 --- a/rpcclient/examples/customcommand/README.md +++ b/rpcclient/examples/customcommand/README.md @@ -9,7 +9,7 @@ implementing the `name_show` command from Namecoin Core. The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/ltcsuite/ltcd/rpcclient +$ go get github.com/ltcmweb/ltcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and diff --git a/rpcclient/examples/customcommand/main.go b/rpcclient/examples/customcommand/main.go index 3f3f37fc7d..b1f189c47d 100644 --- a/rpcclient/examples/customcommand/main.go +++ b/rpcclient/examples/customcommand/main.go @@ -9,8 +9,8 @@ import ( "encoding/json" "log" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/rpcclient" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/rpcclient" ) // NameShowCmd defines the name_show JSON-RPC command. diff --git a/rpcclient/extensions.go b/rpcclient/extensions.go index d007957e88..4cc2d8510b 100644 --- a/rpcclient/extensions.go +++ b/rpcclient/extensions.go @@ -12,10 +12,10 @@ import ( "encoding/json" "fmt" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // FutureDebugLevelResult is a future promise to deliver the result of a diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index a3d5ec412c..135b78ce6d 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -27,8 +27,8 @@ import ( "github.com/btcsuite/go-socks/socks" "github.com/btcsuite/websocket" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg" ) var ( diff --git a/rpcclient/mining.go b/rpcclient/mining.go index 3208cc893d..858039b652 100644 --- a/rpcclient/mining.go +++ b/rpcclient/mining.go @@ -9,9 +9,9 @@ import ( "encoding/json" "errors" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" ) // FutureGenerateResult is a future promise to deliver the result of a diff --git a/rpcclient/net.go b/rpcclient/net.go index 7c83530752..abc6307584 100644 --- a/rpcclient/net.go +++ b/rpcclient/net.go @@ -7,7 +7,7 @@ package rpcclient import ( "encoding/json" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // AddNodeCommand enumerates the available commands that the AddNode function diff --git a/rpcclient/notify.go b/rpcclient/notify.go index e909d34be5..cded1389f3 100644 --- a/rpcclient/notify.go +++ b/rpcclient/notify.go @@ -13,10 +13,10 @@ import ( "fmt" "time" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/rpcclient/rawrequest.go b/rpcclient/rawrequest.go index d9cb680cf9..5b4749b6ec 100644 --- a/rpcclient/rawrequest.go +++ b/rpcclient/rawrequest.go @@ -8,7 +8,7 @@ import ( "encoding/json" "errors" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // FutureRawResult is a future promise to deliver the result of a RawRequest RPC diff --git a/rpcclient/rawtransactions.go b/rpcclient/rawtransactions.go index 05bea6717c..dd44512e61 100644 --- a/rpcclient/rawtransactions.go +++ b/rpcclient/rawtransactions.go @@ -9,10 +9,10 @@ import ( "encoding/hex" "encoding/json" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) const ( diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 571b5ca681..d3233d2229 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -8,11 +8,11 @@ import ( "encoding/json" "strconv" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // ***************************** diff --git a/rpcclient/zmq.go b/rpcclient/zmq.go index f35431d48e..5f91d26855 100644 --- a/rpcclient/zmq.go +++ b/rpcclient/zmq.go @@ -3,7 +3,7 @@ package rpcclient import ( "encoding/json" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // FutureGetZmqNotificationsResult is a future promise to deliver the result of diff --git a/rpcserver.go b/rpcserver.go index 6cccc637f9..fe2328a241 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -28,20 +28,20 @@ import ( "time" "github.com/btcsuite/websocket" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/mempool" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/mining/cpuminer" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/mempool" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/mining/cpuminer" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // API version constants @@ -505,7 +505,7 @@ func peerExists(connMgr rpcserverConnManager, addr string, nodeID int32) bool { // latest protocol version and returns a hex-encoded string of the result. func messageToHex(msg wire.Message) (string, error) { var buf bytes.Buffer - if err := msg.BtcEncode(&buf, maxProtocolVersion, wire.WitnessEncoding); err != nil { + if err := msg.BtcEncode(&buf, maxProtocolVersion, wire.LatestEncoding); err != nil { context := fmt.Sprintf("Failed to encode msg of type %T", msg) return "", internalRPCError(err.Error(), context) } diff --git a/rpcserverhelp.go b/rpcserverhelp.go index 5ccd3cc000..1c60cebbf8 100644 --- a/rpcserverhelp.go +++ b/rpcserverhelp.go @@ -11,7 +11,7 @@ import ( "strings" "sync" - "github.com/ltcsuite/ltcd/btcjson" + "github.com/ltcmweb/ltcd/btcjson" ) // helpDescsEnUS defines the English descriptions used for the help strings. diff --git a/rpcwebsocket.go b/rpcwebsocket.go index 73e36c9f08..146146f339 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -21,14 +21,14 @@ import ( "time" "github.com/btcsuite/websocket" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/btcjson" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/btcjson" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" "golang.org/x/crypto/ripemd160" ) diff --git a/server.go b/server.go index 3724914c45..7bd52cf596 100644 --- a/server.go +++ b/server.go @@ -23,22 +23,22 @@ import ( "time" "github.com/decred/dcrd/lru" - "github.com/ltcsuite/ltcd/addrmgr" - "github.com/ltcsuite/ltcd/blockchain" - "github.com/ltcsuite/ltcd/blockchain/indexers" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/connmgr" - "github.com/ltcsuite/ltcd/database" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/bloom" - "github.com/ltcsuite/ltcd/mempool" - "github.com/ltcsuite/ltcd/mining" - "github.com/ltcsuite/ltcd/mining/cpuminer" - "github.com/ltcsuite/ltcd/netsync" - "github.com/ltcsuite/ltcd/peer" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/addrmgr" + "github.com/ltcmweb/ltcd/blockchain" + "github.com/ltcmweb/ltcd/blockchain/indexers" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/connmgr" + "github.com/ltcmweb/ltcd/database" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/bloom" + "github.com/ltcmweb/ltcd/mempool" + "github.com/ltcmweb/ltcd/mining" + "github.com/ltcmweb/ltcd/mining/cpuminer" + "github.com/ltcmweb/ltcd/netsync" + "github.com/ltcmweb/ltcd/peer" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) const ( @@ -716,15 +716,15 @@ func (sp *serverPeer) OnGetData(_ *peer.Peer, msg *wire.MsgGetData) { var err error switch iv.Type { case wire.InvTypeWitnessTx: - err = sp.server.pushTxMsg(sp, &iv.Hash, c, waitChan, wire.WitnessEncoding) + err = sp.server.pushTxMsg(sp, &iv.Hash, c, waitChan, wire.LatestEncoding) case wire.InvTypeTx: err = sp.server.pushTxMsg(sp, &iv.Hash, c, waitChan, wire.BaseEncoding) case wire.InvTypeWitnessBlock: - err = sp.server.pushBlockMsg(sp, &iv.Hash, c, waitChan, wire.WitnessEncoding) + err = sp.server.pushBlockMsg(sp, &iv.Hash, c, waitChan, wire.LatestEncoding) case wire.InvTypeBlock: err = sp.server.pushBlockMsg(sp, &iv.Hash, c, waitChan, wire.BaseEncoding) case wire.InvTypeFilteredWitnessBlock: - err = sp.server.pushMerkleBlockMsg(sp, &iv.Hash, c, waitChan, wire.WitnessEncoding) + err = sp.server.pushMerkleBlockMsg(sp, &iv.Hash, c, waitChan, wire.LatestEncoding) case wire.InvTypeFilteredBlock: err = sp.server.pushMerkleBlockMsg(sp, &iv.Hash, c, waitChan, wire.BaseEncoding) default: diff --git a/txscript/README.md b/txscript/README.md index b9b173e8df..df41b6c06d 100644 --- a/txscript/README.md +++ b/txscript/README.md @@ -20,7 +20,7 @@ can be found at https://en.bitcoin.it/wiki/Script ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/txscript +$ go get -u github.com/ltcmweb/ltcd/txscript ``` ## Examples diff --git a/txscript/bench_test.go b/txscript/bench_test.go index ed2024c47c..b9c2abe41a 100644 --- a/txscript/bench_test.go +++ b/txscript/bench_test.go @@ -10,8 +10,8 @@ import ( "io/ioutil" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/wire" ) var ( diff --git a/txscript/engine.go b/txscript/engine.go index 77fc160ded..6f6044abfd 100644 --- a/txscript/engine.go +++ b/txscript/engine.go @@ -12,9 +12,9 @@ import ( "math/big" "strings" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // ScriptFlags is a bitmask defining additional operations or tests that will be @@ -146,6 +146,14 @@ const ( // TaprootWitnessVersion is the witness version that defines the new // taproot verification logic. TaprootWitnessVersion = 1 + + // MwebHogAddrWitnessVersion is the witness version of MWEB witness + // programs for HogAddr outputs. + MwebHogAddrWitnessVersion = 8 + + // MwebPeginWitnessVersion is the witness version of MWEB witness + // programs for peg-in transactions. + MwebPeginWitnessVersion = 9 ) // halforder is used to tame ECDSA malleability (see BIP0062). diff --git a/txscript/engine_debug_test.go b/txscript/engine_debug_test.go index cf7b423fd8..25bbb68268 100644 --- a/txscript/engine_debug_test.go +++ b/txscript/engine_debug_test.go @@ -7,9 +7,9 @@ package txscript import ( "testing" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/wire" "github.com/stretchr/testify/require" ) diff --git a/txscript/engine_test.go b/txscript/engine_test.go index 75c827c40c..4cf9026c91 100644 --- a/txscript/engine_test.go +++ b/txscript/engine_test.go @@ -8,8 +8,8 @@ package txscript import ( "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // TestBadPC sets the pc to a deliberately bad result then confirms that Step diff --git a/txscript/example_test.go b/txscript/example_test.go index 79873c5ec6..75216807ad 100644 --- a/txscript/example_test.go +++ b/txscript/example_test.go @@ -9,12 +9,12 @@ import ( "encoding/hex" "fmt" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/txscript" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/txscript" + "github.com/ltcmweb/ltcd/wire" ) // This example demonstrates creating a script which pays to a litecoin address. diff --git a/txscript/hashcache.go b/txscript/hashcache.go index 0352ae45eb..6e2f399ff5 100644 --- a/txscript/hashcache.go +++ b/txscript/hashcache.go @@ -10,8 +10,8 @@ import ( "math" "sync" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // calcHashPrevOuts calculates a single hash of all the previous outputs diff --git a/txscript/hashcache_test.go b/txscript/hashcache_test.go index ca7804ae6c..deb362e9ca 100644 --- a/txscript/hashcache_test.go +++ b/txscript/hashcache_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/wire" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/wire" ) func init() { diff --git a/txscript/opcode.go b/txscript/opcode.go index a6737a8840..b7b06840c8 100644 --- a/txscript/opcode.go +++ b/txscript/opcode.go @@ -16,10 +16,10 @@ import ( "golang.org/x/crypto/ripemd160" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // An opcode defines the information related to a txscript opcode. opfunc, if diff --git a/txscript/pkscript.go b/txscript/pkscript.go index 01a3380aed..3f6ce88be8 100644 --- a/txscript/pkscript.go +++ b/txscript/pkscript.go @@ -5,11 +5,11 @@ import ( "errors" "fmt" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" "golang.org/x/crypto/ripemd160" ) diff --git a/txscript/pkscript_test.go b/txscript/pkscript_test.go index 468cfa150a..06ab745ff1 100644 --- a/txscript/pkscript_test.go +++ b/txscript/pkscript_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // TestParsePkScript ensures that the supported script types can be parsed diff --git a/txscript/reference_test.go b/txscript/reference_test.go index 1dedc5ed30..ac3b72d4ac 100644 --- a/txscript/reference_test.go +++ b/txscript/reference_test.go @@ -17,9 +17,9 @@ import ( "strings" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // scriptTestName returns a descriptive test name for the given reference script diff --git a/txscript/script.go b/txscript/script.go index ddd2b4d1ae..f7df0f1734 100644 --- a/txscript/script.go +++ b/txscript/script.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // Bip16Activation is the timestamp where BIP0016 is valid to use in the @@ -107,6 +107,11 @@ func IsNullData(script []byte) bool { return isNullDataScript(scriptVersion, script) } +// IsMweb returns true if the script encodes an MWEB address, false otherwise. +func IsMweb(script []byte) bool { + return isMwebScript(script) +} + // ExtractWitnessProgramInfo attempts to extract the witness program version, // as well as the witness program itself from the passed script. func ExtractWitnessProgramInfo(script []byte) (int, []byte, error) { @@ -519,6 +524,8 @@ func IsUnspendable(pkScript []byte) bool { return true case len(pkScript) > MaxScriptSize: return true + case IsMweb(pkScript): + return false } // The script is unspendable if it is guaranteed to fail at execution. diff --git a/txscript/script_test.go b/txscript/script_test.go index 39c2175a35..4e463cac0e 100644 --- a/txscript/script_test.go +++ b/txscript/script_test.go @@ -9,7 +9,7 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/wire" ) // TestPushedData ensured the PushedData function extracts the expected data out diff --git a/txscript/sigcache.go b/txscript/sigcache.go index 2ab7bfdaf4..3042c9f670 100644 --- a/txscript/sigcache.go +++ b/txscript/sigcache.go @@ -8,7 +8,7 @@ import ( "bytes" "sync" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // sigCacheEntry represents an entry in the SigCache. Entries within the diff --git a/txscript/sigcache_test.go b/txscript/sigcache_test.go index 9bfd00fd22..9e036c057b 100644 --- a/txscript/sigcache_test.go +++ b/txscript/sigcache_test.go @@ -8,9 +8,9 @@ import ( "crypto/rand" "testing" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // genRandomSig returns a random message, a signature of the message under the diff --git a/txscript/sighash.go b/txscript/sighash.go index 530895538c..fc5b9bf62a 100644 --- a/txscript/sighash.go +++ b/txscript/sighash.go @@ -13,8 +13,8 @@ import ( "io" "math" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // SigHashType represents hash type bits at the end of a signature. diff --git a/txscript/sign.go b/txscript/sign.go index 413ee81579..be8a6cfe53 100644 --- a/txscript/sign.go +++ b/txscript/sign.go @@ -7,13 +7,13 @@ package txscript import ( "errors" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/wire" ) // RawTxInWitnessSignature returns the serialized ECDA signature for the input diff --git a/txscript/sign_test.go b/txscript/sign_test.go index daee2f57e9..60e7b60f03 100644 --- a/txscript/sign_test.go +++ b/txscript/sign_test.go @@ -9,12 +9,12 @@ import ( "fmt" "testing" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" "github.com/stretchr/testify/require" ) diff --git a/txscript/sigvalidate.go b/txscript/sigvalidate.go index 0872dcb328..235010a8be 100644 --- a/txscript/sigvalidate.go +++ b/txscript/sigvalidate.go @@ -7,11 +7,11 @@ package txscript import ( "fmt" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/ecdsa" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/ecdsa" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // signatureVerifier is an abstract interface that allows the op code execution diff --git a/txscript/standard.go b/txscript/standard.go index 4716c926a2..a6e56f2733 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -7,9 +7,11 @@ package txscript import ( "fmt" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "github.com/ltcmweb/ltcd/wire" ) const ( @@ -63,7 +65,10 @@ const ( MultiSigTy // Multi signature. NullDataTy // Empty data-only (provably prunable). WitnessV1TaprootTy // Taproot output + WitnessMwebHogAddrTy // MWEB HogAddr (first output of HogEx). + WitnessMwebPeginTy // Hash of the MWEB peg-in kernel. WitnessUnknownTy // Witness unknown + MwebTy // MWEB address ) // scriptClassToName houses the human-readable strings which describe each @@ -78,7 +83,10 @@ var scriptClassToName = []string{ MultiSigTy: "multisig", NullDataTy: "nulldata", WitnessV1TaprootTy: "witness_v1_taproot", + WitnessMwebHogAddrTy: "witness_mweb_hogaddr", + WitnessMwebPeginTy: "witness_mweb_pegin", WitnessUnknownTy: "witness_unknown", + MwebTy: "mweb", } // String implements the Stringer interface by returning the name of @@ -149,6 +157,28 @@ func isPubKeyScript(script []byte) bool { return extractPubKey(script) != nil } +func extractMweb(script []byte) *mw.StealthAddress { + if len(script) == 66 { + pk1 := script[:33] + pk2 := script[33:] + if _, err := btcec.ParsePubKey(pk1); err != nil { + return nil + } + if _, err := btcec.ParsePubKey(pk2); err != nil { + return nil + } + return &mw.StealthAddress{ + Scan: (*mw.PublicKey)(pk1), + Spend: (*mw.PublicKey)(pk2), + } + } + return nil +} + +func isMwebScript(script []byte) bool { + return extractMweb(script) != nil +} + // extractPubKeyHash extracts the public key hash from the passed script if it // is a standard pay-to-pubkey-hash script. It will return nil otherwise. func extractPubKeyHash(script []byte) []byte { @@ -530,6 +560,7 @@ func isNullDataScript(scriptVersion uint16, script []byte) bool { func typeOfScript(scriptVersion uint16, script []byte) ScriptClass { switch scriptVersion { case BaseSegwitWitnessVersion: + ver, prog, ok := extractWitnessProgramInfo(script) switch { case isPubKeyScript(script): return PubKeyTy @@ -541,6 +572,10 @@ func typeOfScript(scriptVersion uint16, script []byte) ScriptClass { return WitnessV0PubKeyHashTy case isWitnessScriptHashScript(script): return WitnessV0ScriptHashTy + case ver == MwebHogAddrWitnessVersion && len(prog) == 32 && ok: + return WitnessMwebHogAddrTy + case ver == MwebPeginWitnessVersion && len(prog) == 32 && ok: + return WitnessMwebPeginTy case isMultisigScript(scriptVersion, script): return MultiSigTy case isNullDataScript(scriptVersion, script): @@ -874,6 +909,12 @@ func PayToAddrScript(addr ltcutil.Address) ([]byte, error) { nilAddrErrStr) } return payToWitnessTaprootScript(addr.ScriptAddress()) + case *ltcutil.AddressMweb: + if addr == nil { + return nil, scriptError(ErrUnsupportedAddress, + nilAddrErrStr) + } + return addr.ScriptAddress(), nil } str := fmt.Sprintf("unable to generate payment script for unsupported "+ @@ -1037,6 +1078,26 @@ func ExtractPkScriptAddrs(pkScript []byte, return WitnessV1TaprootTy, addrs, 1, nil } + if ver, prog, ok := extractWitnessProgramInfo(pkScript); ok { + var addrs []ltcutil.Address + addr, err := ltcutil.NewAddressWitnessMweb( + byte(ver), prog, chainParams) + if err == nil { + addrs = append(addrs, addr) + } + switch ver { + case MwebHogAddrWitnessVersion: + return WitnessMwebHogAddrTy, addrs, 1, nil + case MwebPeginWitnessVersion: + return WitnessMwebPeginTy, addrs, 1, nil + } + } + + if sa := extractMweb(pkScript); sa != nil { + addr := ltcutil.NewAddressMweb(sa, chainParams) + return MwebTy, []ltcutil.Address{addr}, 1, nil + } + // If none of the above passed, then the address must be non-standard. return NonStandardTy, nil, 0, nil } diff --git a/txscript/standard_test.go b/txscript/standard_test.go index 88acd879f0..823c7ebcc9 100644 --- a/txscript/standard_test.go +++ b/txscript/standard_test.go @@ -11,9 +11,9 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/wire" ) // mustParseShortForm parses the passed short form script and returns the diff --git a/txscript/taproot.go b/txscript/taproot.go index cd5e3affeb..514204d119 100644 --- a/txscript/taproot.go +++ b/txscript/taproot.go @@ -9,10 +9,10 @@ import ( "fmt" secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "github.com/ltcsuite/ltcd/wire" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/wire" ) // TapscriptLeafVersion represents the various possible versions of a tapscript diff --git a/txscript/taproot_test.go b/txscript/taproot_test.go index 633ac88b7f..6b6bf7d457 100644 --- a/txscript/taproot_test.go +++ b/txscript/taproot_test.go @@ -13,11 +13,11 @@ import ( "testing/quick" secp "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/ltcsuite/ltcd/btcec/v2" - "github.com/ltcsuite/ltcd/btcec/v2/schnorr" - "github.com/ltcsuite/ltcd/chaincfg" - "github.com/ltcsuite/ltcd/ltcutil" - "github.com/ltcsuite/ltcd/ltcutil/hdkeychain" + "github.com/ltcmweb/ltcd/btcec/v2" + "github.com/ltcmweb/ltcd/btcec/v2/schnorr" + "github.com/ltcmweb/ltcd/chaincfg" + "github.com/ltcmweb/ltcd/ltcutil" + "github.com/ltcmweb/ltcd/ltcutil/hdkeychain" "github.com/stretchr/testify/require" ) diff --git a/wire/README.md b/wire/README.md index cbee47938f..2f37a7f658 100644 --- a/wire/README.md +++ b/wire/README.md @@ -18,7 +18,7 @@ protocol level. ## Installation and Updating ```bash -$ go get -u github.com/ltcsuite/ltcd/wire +$ go get -u github.com/ltcmweb/ltcd/wire ``` ## Litecoin Message Overview diff --git a/wire/bench_test.go b/wire/bench_test.go index 96c77ccdcc..6f03759020 100644 --- a/wire/bench_test.go +++ b/wire/bench_test.go @@ -13,7 +13,7 @@ import ( "os" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // genesisCoinbaseTx is the coinbase transaction for the genesis blocks for diff --git a/wire/blockheader.go b/wire/blockheader.go index bacb328a0f..87f7d89413 100644 --- a/wire/blockheader.go +++ b/wire/blockheader.go @@ -9,9 +9,8 @@ import ( "io" "time" - "golang.org/x/crypto/scrypt" - - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/scrypt" ) // MaxBlockHeaderPayload is the maximum number of bytes a block header can be. @@ -61,15 +60,10 @@ func (h *BlockHeader) BlockHash() chainhash.Hash { // PowHash returns the litecoin scrypt hash of this block header. This value is // used to check the PoW on blocks advertised on the network. func (h *BlockHeader) PowHash() chainhash.Hash { - var powHash chainhash.Hash - buf := bytes.NewBuffer(make([]byte, 0, MaxBlockHeaderPayload)) _ = writeBlockHeader(buf, 0, h) - scryptHash, _ := scrypt.Key(buf.Bytes(), buf.Bytes(), 1024, 1, 1, 32) - copy(powHash[:], scryptHash) - - return powHash + return *(*chainhash.Hash)(scrypt.Scrypt(buf.Bytes())) } // BtcDecode decodes r using the litecoin protocol encoding into the receiver. diff --git a/wire/common.go b/wire/common.go index 2c351d6ff4..51a714913c 100644 --- a/wire/common.go +++ b/wire/common.go @@ -12,7 +12,7 @@ import ( "math" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( diff --git a/wire/common_test.go b/wire/common_test.go index d7a73d050a..20cd4f2a26 100644 --- a/wire/common_test.go +++ b/wire/common_test.go @@ -13,7 +13,7 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // mainNetGenesisHash is the hash of the first block in the block chain for the diff --git a/wire/invvect.go b/wire/invvect.go index c5aca5ab6a..3fe54ee983 100644 --- a/wire/invvect.go +++ b/wire/invvect.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( @@ -22,6 +22,10 @@ const ( // InvWitnessFlag denotes that the inventory vector type is requesting, // or sending a version which includes witness data. InvWitnessFlag = 1 << 30 + + // InvMwebFlag denotes that the inventory vector type is requesting, + // or sending a version which includes MWEB data. + InvMwebFlag = 1 << 29 ) // InvType represents the allowed types of inventory vectors. See InvVect. @@ -36,6 +40,10 @@ const ( InvTypeWitnessBlock InvType = InvTypeBlock | InvWitnessFlag InvTypeWitnessTx InvType = InvTypeTx | InvWitnessFlag InvTypeFilteredWitnessBlock InvType = InvTypeFilteredBlock | InvWitnessFlag + InvTypeMwebBlock InvType = InvTypeWitnessBlock | InvMwebFlag + InvTypeMwebTx InvType = InvTypeWitnessTx | InvMwebFlag + InvTypeMwebHeader InvType = 8 | InvMwebFlag + InvTypeMwebLeafset InvType = 9 | InvMwebFlag ) // Map of service flags back to their constant names for pretty printing. @@ -47,6 +55,10 @@ var ivStrings = map[InvType]string{ InvTypeWitnessBlock: "MSG_WITNESS_BLOCK", InvTypeWitnessTx: "MSG_WITNESS_TX", InvTypeFilteredWitnessBlock: "MSG_FILTERED_WITNESS_BLOCK", + InvTypeMwebBlock: "MSG_MWEB_BLOCK", + InvTypeMwebTx: "MSG_MWEB_TX", + InvTypeMwebHeader: "MSG_MWEB_HEADER", + InvTypeMwebLeafset: "MSG_MWEB_LEAFSET", } // String returns the InvType in human-readable form. diff --git a/wire/invvect_test.go b/wire/invvect_test.go index 4d9eb49648..c61654de80 100644 --- a/wire/invvect_test.go +++ b/wire/invvect_test.go @@ -9,8 +9,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestInvVectStringer tests the stringized output for inventory vector types. diff --git a/wire/message.go b/wire/message.go index e13c9d297d..a0d4443eff 100644 --- a/wire/message.go +++ b/wire/message.go @@ -10,7 +10,7 @@ import ( "io" "unicode/utf8" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // MessageHeaderSize is the number of bytes in a litecoin message header. @@ -59,6 +59,10 @@ const ( CmdCFHeaders = "cfheaders" CmdCFCheckpt = "cfcheckpt" CmdSendAddrV2 = "sendaddrv2" + CmdMwebHeader = "mwebheader" + CmdMwebLeafset = "mwebleafset" + CmdGetMwebUtxos = "getmwebutxos" + CmdMwebUtxos = "mwebutxos" ) // MessageEncoding represents the wire message encoding format to be used. @@ -73,11 +77,16 @@ const ( // using the default Litecoin wire protocol specification. For transaction // messages, the new encoding format detailed in BIP0144 will be used. WitnessEncoding -) -// LatestEncoding is the most recently specified encoding for the Litecoin wire -// protocol. -var LatestEncoding = WitnessEncoding + // MwebEncoding encodes all messages other than transaction messages + // using the default Litecoin wire protocol specification. For transaction + // messages, the new encoding format detailed in LIP0003 will be used. + MwebEncoding + + // LatestEncoding is the most recently specified encoding for the + // Litecoin wire protocol. + LatestEncoding = WitnessEncoding | MwebEncoding +) // ErrUnknownMessage is the error returned when decoding an unknown message. var ErrUnknownMessage = fmt.Errorf("received unknown message") @@ -195,6 +204,15 @@ func makeEmptyMessage(command string) (Message, error) { case CmdCFCheckpt: msg = &MsgCFCheckpt{} + case CmdMwebHeader: + msg = &MsgMwebHeader{} + + case CmdMwebLeafset: + msg = &MsgMwebLeafset{} + + case CmdMwebUtxos: + msg = &MsgMwebUtxos{} + default: return nil, ErrUnknownMessage } diff --git a/wire/message_test.go b/wire/message_test.go index 299298dea8..704bdb49d0 100644 --- a/wire/message_test.go +++ b/wire/message_test.go @@ -14,7 +14,7 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // makeHeader is a convenience function to make a message header in the form of diff --git a/wire/msgblock.go b/wire/msgblock.go index 3100658a80..64e6a76501 100644 --- a/wire/msgblock.go +++ b/wire/msgblock.go @@ -9,7 +9,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // defaultTransactionAlloc is the default size used for the backing array @@ -45,8 +45,10 @@ type TxLoc struct { // block message. It is used to deliver block and transaction information in // response to a getdata message (MsgGetData) for a given block hash. type MsgBlock struct { - Header BlockHeader - Transactions []*MsgTx + Header BlockHeader + Transactions []*MsgTx + MwebHeader *MwebHeader + MwebTransactions *MwebTxBody } // AddTransaction adds a transaction to the message. @@ -94,15 +96,28 @@ func (msg *MsgBlock) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) er return err } msg.Transactions = append(msg.Transactions, &tx) + if tx.IsHogEx && i != txCount-1 { + return messageError("MsgBlock.BtcDecode", "HogEx must be the last transaction") + } hasHogEx = tx.IsHogEx } // The mwebVer mask indicates it may contain a MWEB after a HogEx. - // src/primitives/block.h: SERIALIZE_NO_MWEB if msg.Header.Version&mwebVer != 0 && hasHogEx { - if err = parseMWEB(r); err != nil { + var hasMweb byte + if err = readElement(r, &hasMweb); err != nil { return err } + if hasMweb == 1 { + msg.MwebHeader = &MwebHeader{} + if err = msg.MwebHeader.read(r); err != nil { + return err + } + msg.MwebTransactions = &MwebTxBody{} + if err = msg.MwebTransactions.read(r, pver); err != nil { + return err + } + } } return nil @@ -198,11 +213,37 @@ func (msg *MsgBlock) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) er return err } - for _, tx := range msg.Transactions { + var hasHogEx bool + for i, tx := range msg.Transactions { err = tx.BtcEncode(w, pver, enc) if err != nil { return err } + if tx.IsHogEx && i != len(msg.Transactions)-1 { + return messageError("MsgBlock.BtcEncode", "HogEx must be the last transaction") + } + hasHogEx = tx.IsHogEx + } + + if hasHogEx { + err = writeElement(w, byte(1)) + if err != nil { + return err + } + if msg.MwebHeader == nil { + return messageError("MsgBlock.BtcEncode", "missing mweb header") + } + err = msg.MwebHeader.write(w) + if err != nil { + return err + } + if msg.MwebTransactions == nil { + return messageError("MsgBlock.BtcEncode", "missing mweb txbody") + } + err = msg.MwebTransactions.write(w, pver) + if err != nil { + return err + } } return nil @@ -225,7 +266,7 @@ func (msg *MsgBlock) Serialize(w io.Writer) error { // Passing WitnessEncoding as the encoding type here indicates that // each of the transactions should be serialized using the witness // serialization structure defined in BIP0141. - return msg.BtcEncode(w, 0, WitnessEncoding) + return msg.BtcEncode(w, 0, LatestEncoding) } // SerializeNoWitness encodes a block to w using an identical format to @@ -302,55 +343,3 @@ func NewMsgBlock(blockHeader *BlockHeader) *MsgBlock { Transactions: make([]*MsgTx, 0, defaultTransactionAlloc), } } - -/// MWEB - -func parseMWEB(blk io.Reader) error { - dec := newDecoder(blk) - // src/mweb/mweb_models.h - struct Block - // "A convenience wrapper around a possibly-null extension block."" - // OptionalPtr around a mw::Block. Read the option byte: - hasMWEB, err := dec.readByte() - if err != nil { - return fmt.Errorf("failed to check MWEB option byte: %w", err) - } - if hasMWEB == 0 { - return nil - } - - // src/libmw/include/mw/models/block/Block.h - class Block - // (1) Header and (2) TxBody - - // src/libmw/include/mw/models/block/Header.h - class Header - // height - if _, err = dec.readVLQ(); err != nil { - return fmt.Errorf("failed to decode MWEB height: %w", err) - } - - // 3x Hash + 2x BlindingFactor - if err = dec.discardBytes(32*3 + 32*2); err != nil { - return fmt.Errorf("failed to decode MWEB junk: %w", err) - } - - // Number of TXOs: outputMMRSize - if _, err = dec.readVLQ(); err != nil { - return fmt.Errorf("failed to decode TXO count: %w", err) - } - - // Number of kernels: kernelMMRSize - if _, err = dec.readVLQ(); err != nil { - return fmt.Errorf("failed to decode kernel count: %w", err) - } - - // TxBody - _, err = dec.readMWTXBody() - if err != nil { - return fmt.Errorf("failed to decode MWEB tx: %w", err) - } - // if len(kern0) > 0 { - // mwebTxID := chainhash.Hash(blake3.Sum256(kern0)) - // fmt.Println(mwebTxID.String()) - // } - - return nil -} diff --git a/wire/msgblock_test.go b/wire/msgblock_test.go index b7c7140276..7a983ecdee 100644 --- a/wire/msgblock_test.go +++ b/wire/msgblock_test.go @@ -13,7 +13,7 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) var ( diff --git a/wire/msgcfcheckpt.go b/wire/msgcfcheckpt.go index 1136c46978..8a2201f198 100644 --- a/wire/msgcfcheckpt.go +++ b/wire/msgcfcheckpt.go @@ -9,7 +9,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( diff --git a/wire/msgcfheaders.go b/wire/msgcfheaders.go index 9fe00094d3..485d5f6927 100644 --- a/wire/msgcfheaders.go +++ b/wire/msgcfheaders.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( diff --git a/wire/msgcfilter.go b/wire/msgcfilter.go index d8aad9b467..f6c394e562 100644 --- a/wire/msgcfilter.go +++ b/wire/msgcfilter.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // FilterType is used to represent a filter type. diff --git a/wire/msggetblocks.go b/wire/msggetblocks.go index 801c12dde0..c27680ce6b 100644 --- a/wire/msggetblocks.go +++ b/wire/msggetblocks.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // MaxBlockLocatorsPerMsg is the maximum number of block locator hashes allowed diff --git a/wire/msggetblocks_test.go b/wire/msggetblocks_test.go index 7312e404c9..07c9174803 100644 --- a/wire/msggetblocks_test.go +++ b/wire/msggetblocks_test.go @@ -10,8 +10,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestGetBlocks tests the MsgGetBlocks API. diff --git a/wire/msggetcfcheckpt.go b/wire/msggetcfcheckpt.go index ca256d95a7..9563c40757 100644 --- a/wire/msggetcfcheckpt.go +++ b/wire/msggetcfcheckpt.go @@ -7,7 +7,7 @@ package wire import ( "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // MsgGetCFCheckpt is a request for filter headers at evenly spaced intervals diff --git a/wire/msggetcfheaders.go b/wire/msggetcfheaders.go index f51eff96d4..267f68f1a4 100644 --- a/wire/msggetcfheaders.go +++ b/wire/msggetcfheaders.go @@ -7,7 +7,7 @@ package wire import ( "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // MsgGetCFHeaders is a message similar to MsgGetHeaders, but for committed diff --git a/wire/msggetcfilters.go b/wire/msggetcfilters.go index 289a4e1220..4a4ceba1ed 100644 --- a/wire/msggetcfilters.go +++ b/wire/msggetcfilters.go @@ -7,7 +7,7 @@ package wire import ( "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // MaxGetCFiltersReqRange the maximum number of filters that may be requested in diff --git a/wire/msggetdata_test.go b/wire/msggetdata_test.go index 8efac6f776..e9c0e85844 100644 --- a/wire/msggetdata_test.go +++ b/wire/msggetdata_test.go @@ -10,8 +10,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestGetData tests the MsgGetData API. diff --git a/wire/msggetheaders.go b/wire/msggetheaders.go index a80ade6596..40d2d2da75 100644 --- a/wire/msggetheaders.go +++ b/wire/msggetheaders.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // MsgGetHeaders implements the Message interface and represents a litecoin diff --git a/wire/msggetheaders_test.go b/wire/msggetheaders_test.go index c5207a9459..81e7378ff0 100644 --- a/wire/msggetheaders_test.go +++ b/wire/msggetheaders_test.go @@ -10,8 +10,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestGetHeaders tests the MsgGetHeader API. diff --git a/wire/msggetmwebutxos.go b/wire/msggetmwebutxos.go new file mode 100644 index 0000000000..28316dc3d4 --- /dev/null +++ b/wire/msggetmwebutxos.go @@ -0,0 +1,100 @@ +// Copyright (c) 2024 The ltcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package wire + +import ( + "fmt" + "io" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" +) + +type MwebNetUtxoType byte + +const ( + MwebNetUtxoFull MwebNetUtxoType = iota + MwebNetUtxoHashOnly + MwebNetUtxoCompact +) + +// MsgGetMwebUtxos implements the Message interface and represents a litecoin +// getmwebutxos message which is used to request a batch of MWEB UTXOs. +// +// This message was not added until protocol version MwebLightClientVersion. +type MsgGetMwebUtxos struct { + BlockHash chainhash.Hash + StartIndex uint64 + NumRequested uint16 + OutputFormat MwebNetUtxoType +} + +// BtcDecode decodes r using the litecoin protocol encoding into the receiver. +// This is part of the Message interface implementation. +func (msg *MsgGetMwebUtxos) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("getmwebutxos message invalid for protocol "+ + "version %d", pver) + return messageError("MsgGetMwebUtxos.BtcDecode", str) + } + + err := readElement(r, &msg.BlockHash) + if err != nil { + return err + } + + msg.StartIndex, err = ReadVarInt(r, pver) + if err != nil { + return err + } + + return readElements(r, &msg.NumRequested, &msg.OutputFormat) +} + +// BtcEncode encodes the receiver to w using the litecoin protocol encoding. +// This is part of the Message interface implementation. +func (msg *MsgGetMwebUtxos) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("getmwebutxos message invalid for protocol "+ + "version %d", pver) + return messageError("MsgGetMwebUtxos.BtcEncode", str) + } + + err := writeElement(w, &msg.BlockHash) + if err != nil { + return err + } + + err = WriteVarInt(w, pver, msg.StartIndex) + if err != nil { + return err + } + + return writeElements(w, msg.NumRequested, msg.OutputFormat) +} + +// Command returns the protocol command string for the message. This is part +// of the Message interface implementation. +func (msg *MsgGetMwebUtxos) Command() string { + return CmdGetMwebUtxos +} + +// MaxPayloadLength returns the maximum length the payload can be for the +// receiver. This is part of the Message interface implementation. +func (msg *MsgGetMwebUtxos) MaxPayloadLength(pver uint32) uint32 { + return MaxBlockPayload +} + +// NewMsgGetMwebUtxos returns a new litecoin getmwebutxos message that conforms to +// the Message interface. See MsgGetMwebUtxos for details. +func NewMsgGetMwebUtxos(blockHash chainhash.Hash, startIndex uint64, + numRequested uint16, outputFormat MwebNetUtxoType) *MsgGetMwebUtxos { + + return &MsgGetMwebUtxos{ + BlockHash: blockHash, + StartIndex: startIndex, + NumRequested: numRequested, + OutputFormat: outputFormat, + } +} diff --git a/wire/msginv_test.go b/wire/msginv_test.go index 5d55724a83..60baf3ee02 100644 --- a/wire/msginv_test.go +++ b/wire/msginv_test.go @@ -10,8 +10,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestInv tests the MsgInv API. diff --git a/wire/msgmerkleblock.go b/wire/msgmerkleblock.go index 5fa7b46d36..fe2c481c82 100644 --- a/wire/msgmerkleblock.go +++ b/wire/msgmerkleblock.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // maxFlagsPerMerkleBlock is the maximum number of flag bytes that could diff --git a/wire/msgmerkleblock_test.go b/wire/msgmerkleblock_test.go index 328befeacd..bf8a8776c3 100644 --- a/wire/msgmerkleblock_test.go +++ b/wire/msgmerkleblock_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestMerkleBlock tests the MsgMerkleBlock API. diff --git a/wire/msgmwebheader.go b/wire/msgmwebheader.go new file mode 100644 index 0000000000..ec0305024b --- /dev/null +++ b/wire/msgmwebheader.go @@ -0,0 +1,86 @@ +// Copyright (c) 2024 The ltcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package wire + +import ( + "fmt" + "io" +) + +// MsgMwebHeader implements the Message interface and represents a litecoin +// mwebheader message which is used for syncing MWEB headers. +// +// This message was not added until protocol version MwebLightClientVersion. +type MsgMwebHeader struct { + Merkle MsgMerkleBlock + Hogex MsgTx + MwebHeader MwebHeader +} + +// BtcDecode decodes r using the litecoin protocol encoding into the receiver. +// This is part of the Message interface implementation. +func (msg *MsgMwebHeader) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("mwebheader message invalid for protocol "+ + "version %d", pver) + return messageError("MsgMwebHeader.BtcDecode", str) + } + + err := msg.Merkle.BtcDecode(r, pver, enc) + if err != nil { + return err + } + + err = msg.Hogex.BtcDecode(r, pver, enc) + if err != nil { + return err + } + + return msg.MwebHeader.read(r) +} + +// BtcEncode encodes the receiver to w using the litecoin protocol encoding. +// This is part of the Message interface implementation. +func (msg *MsgMwebHeader) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("mwebheader message invalid for protocol "+ + "version %d", pver) + return messageError("MsgMwebHeader.BtcEncode", str) + } + + err := msg.Merkle.BtcEncode(w, pver, enc) + if err != nil { + return err + } + + err = msg.Hogex.BtcEncode(w, pver, enc) + if err != nil { + return err + } + + return msg.MwebHeader.write(w) +} + +// Command returns the protocol command string for the message. This is part +// of the Message interface implementation. +func (msg *MsgMwebHeader) Command() string { + return CmdMwebHeader +} + +// MaxPayloadLength returns the maximum length the payload can be for the +// receiver. This is part of the Message interface implementation. +func (msg *MsgMwebHeader) MaxPayloadLength(pver uint32) uint32 { + return MaxBlockPayload +} + +// NewMsgMwebHeader returns a new litecoin mwebheader message that conforms to +// the Message interface. See MsgMwebHeader for details. +func NewMsgMwebHeader(mb *MsgMerkleBlock, hogex *MsgTx, mh *MwebHeader) *MsgMwebHeader { + return &MsgMwebHeader{ + Merkle: *mb, + Hogex: *hogex, + MwebHeader: *mh, + } +} diff --git a/wire/msgmwebleafset.go b/wire/msgmwebleafset.go new file mode 100644 index 0000000000..8d9ee0c7d7 --- /dev/null +++ b/wire/msgmwebleafset.go @@ -0,0 +1,78 @@ +// Copyright (c) 2024 The ltcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package wire + +import ( + "fmt" + "io" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" +) + +// MsgMwebLeafset implements the Message interface and represents a litecoin +// mwebleafset message which is used for retrieving the leaf indices of all +// unspent MWEB UTXOs. +// +// This message was not added until protocol version MwebLightClientVersion. +type MsgMwebLeafset struct { + BlockHash chainhash.Hash + Leafset []byte +} + +// BtcDecode decodes r using the litecoin protocol encoding into the receiver. +// This is part of the Message interface implementation. +func (msg *MsgMwebLeafset) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("mwebleafset message invalid for protocol "+ + "version %d", pver) + return messageError("MsgMwebLeafset.BtcDecode", str) + } + + err := readElement(r, &msg.BlockHash) + if err != nil { + return err + } + + msg.Leafset, err = ReadVarBytes(r, pver, MaxMessagePayload, "Leafset") + return err +} + +// BtcEncode encodes the receiver to w using the litecoin protocol encoding. +// This is part of the Message interface implementation. +func (msg *MsgMwebLeafset) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("mwebleafset message invalid for protocol "+ + "version %d", pver) + return messageError("MsgMwebLeafset.BtcEncode", str) + } + + err := writeElement(w, &msg.BlockHash) + if err != nil { + return err + } + + return WriteVarBytes(w, pver, msg.Leafset) +} + +// Command returns the protocol command string for the message. This is part +// of the Message interface implementation. +func (msg *MsgMwebLeafset) Command() string { + return CmdMwebLeafset +} + +// MaxPayloadLength returns the maximum length the payload can be for the +// receiver. This is part of the Message interface implementation. +func (msg *MsgMwebLeafset) MaxPayloadLength(pver uint32) uint32 { + return MaxBlockPayload +} + +// NewMsgMwebLeafset returns a new litecoin mwebleafset message that conforms to +// the Message interface. See MsgMwebLeafset for details. +func NewMsgMwebLeafset(blockHash *chainhash.Hash, leafset []byte) *MsgMwebLeafset { + return &MsgMwebLeafset{ + BlockHash: *blockHash, + Leafset: leafset, + } +} diff --git a/wire/msgmwebutxos.go b/wire/msgmwebutxos.go new file mode 100644 index 0000000000..a758470084 --- /dev/null +++ b/wire/msgmwebutxos.go @@ -0,0 +1,227 @@ +// Copyright (c) 2024 The ltcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package wire + +import ( + "errors" + "fmt" + "io" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" +) + +const MaxMwebUtxosPerQuery = 4096 + +type MwebNetUtxo struct { + Height int32 // memory only + LeafIndex uint64 + Output *MwebOutput + OutputId *chainhash.Hash +} + +// readMwebNetUtxo reads a litecoin mweb utxo from r. See Deserialize for +// decoding mweb utxos stored to disk, such as in a database, as opposed to +// decoding from the wire. +func readMwebNetUtxo(r io.Reader, pver uint32, utxo *MwebNetUtxo, + utxoType MwebNetUtxoType) (err error) { + + utxo.LeafIndex, err = ReadVarInt(r, pver) + if err != nil { + return + } + + switch utxoType { + case MwebNetUtxoFull: + utxo.Output = new(MwebOutput) + err = utxo.Output.read(r, pver, false) + case MwebNetUtxoHashOnly: + err = readElement(r, &utxo.OutputId) + case MwebNetUtxoCompact: + utxo.Output = new(MwebOutput) + err = utxo.Output.read(r, pver, true) + } + if err != nil { + return + } + + if utxo.Output != nil { + utxo.OutputId = utxo.Output.Hash() + } + + return +} + +// writeMwebNetUtxo writes a litecoin mweb utxo to w. See Serialize for +// encoding mweb utxos to be stored to disk, such as in a database, as +// opposed to encoding for the wire. +func writeMwebNetUtxo(w io.Writer, pver uint32, utxo *MwebNetUtxo, + utxoType MwebNetUtxoType) error { + + err := WriteVarInt(w, pver, utxo.LeafIndex) + if err != nil { + return err + } + + if utxo.Output != nil { + utxo.OutputId = utxo.Output.Hash() + } + + switch utxoType { + case MwebNetUtxoFull: + err = utxo.Output.write(w, pver, false, false) + case MwebNetUtxoHashOnly: + err = writeElement(w, &utxo.OutputId) + case MwebNetUtxoCompact: + err = utxo.Output.write(w, pver, true, false) + } + + return err +} + +// MsgMwebUtxos implements the Message interface and represents a litecoin +// mwebutxos message which is used to send a batch of MWEB UTXOs. +// +// This message was not added until protocol version MwebLightClientVersion. +type MsgMwebUtxos struct { + BlockHash chainhash.Hash + StartIndex uint64 + OutputFormat MwebNetUtxoType + Utxos []*MwebNetUtxo + ProofHashes []*chainhash.Hash +} + +// BtcDecode decodes r using the litecoin protocol encoding into the receiver. +// This is part of the Message interface implementation. +func (msg *MsgMwebUtxos) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("mwebutxos message invalid for protocol "+ + "version %d", pver) + return messageError("MsgMwebUtxos.BtcDecode", str) + } + + err := readElement(r, &msg.BlockHash) + if err != nil { + return err + } + + msg.StartIndex, err = ReadVarInt(r, pver) + if err != nil { + return err + } + + err = readElement(r, &msg.OutputFormat) + if err != nil { + return err + } + + count, err := ReadVarInt(r, pver) + if err != nil { + return err + } + if count > MaxMwebUtxosPerQuery { + return errors.New("count exceeds MaxMwebUtxosPerQuery") + } + msg.Utxos = make([]*MwebNetUtxo, count) + + for i := range msg.Utxos { + utxo := new(MwebNetUtxo) + if err = readMwebNetUtxo(r, pver, utxo, msg.OutputFormat); err != nil { + return err + } + msg.Utxos[i] = utxo + } + + count, err = ReadVarInt(r, pver) + if err != nil { + return err + } + if count > 1e5 { + return errors.New("too many proof hashes") + } + msg.ProofHashes = make([]*chainhash.Hash, count) + + for i := range msg.ProofHashes { + hash := new(chainhash.Hash) + if err = readElement(r, hash); err != nil { + return err + } + msg.ProofHashes[i] = hash + } + + return err +} + +// BtcEncode encodes the receiver to w using the litecoin protocol encoding. +// This is part of the Message interface implementation. +func (msg *MsgMwebUtxos) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { + if pver < MwebLightClientVersion { + str := fmt.Sprintf("mwebutxos message invalid for protocol "+ + "version %d", pver) + return messageError("MsgMwebUtxos.BtcEncode", str) + } + + err := writeElement(w, &msg.BlockHash) + if err != nil { + return err + } + + err = WriteVarInt(w, pver, msg.StartIndex) + if err != nil { + return err + } + + err = writeElement(w, msg.OutputFormat) + if err != nil { + return err + } + + err = WriteVarInt(w, pver, uint64(len(msg.Utxos))) + if err != nil { + return err + } + + for _, utxo := range msg.Utxos { + if err = writeMwebNetUtxo(w, pver, utxo, msg.OutputFormat); err != nil { + return err + } + } + + err = WriteVarInt(w, pver, uint64(len(msg.ProofHashes))) + if err != nil { + return err + } + + for _, hash := range msg.ProofHashes { + if err = writeElement(w, hash); err != nil { + return err + } + } + + return err +} + +// Command returns the protocol command string for the message. This is part +// of the Message interface implementation. +func (msg *MsgMwebUtxos) Command() string { + return CmdMwebUtxos +} + +// MaxPayloadLength returns the maximum length the payload can be for the +// receiver. This is part of the Message interface implementation. +func (msg *MsgMwebUtxos) MaxPayloadLength(pver uint32) uint32 { + return MaxBlockPayload +} + +// NewMsgMwebUtxos returns a new litecoin mwebutxos message that conforms to +// the Message interface. See MsgMwebUtxos for details. +func NewMsgMwebUtxos(blockHash chainhash.Hash, startIndex uint64, + outputFormat MwebNetUtxoType) *MsgMwebUtxos { + + return &MsgMwebUtxos{ + BlockHash: blockHash, + StartIndex: startIndex, + OutputFormat: outputFormat, + } +} diff --git a/wire/msgnotfound_test.go b/wire/msgnotfound_test.go index 26f5a4f0f7..b623565a91 100644 --- a/wire/msgnotfound_test.go +++ b/wire/msgnotfound_test.go @@ -10,8 +10,8 @@ import ( "reflect" "testing" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" "github.com/davecgh/go-spew/spew" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // TestNotFound tests the MsgNotFound API. diff --git a/wire/msgreject.go b/wire/msgreject.go index 3f8626832e..32b4b9a5d7 100644 --- a/wire/msgreject.go +++ b/wire/msgreject.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) // RejectCode represents a numeric value by which a remote peer indicates diff --git a/wire/msgtx.go b/wire/msgtx.go index 3ce0479a0e..94c7dfc902 100644 --- a/wire/msgtx.go +++ b/wire/msgtx.go @@ -12,8 +12,7 @@ import ( "strconv" "strings" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" - "lukechampine.com/blake3" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" ) const ( @@ -346,7 +345,7 @@ type MsgTx struct { TxOut []*TxOut LockTime uint32 IsHogEx bool - Kern0 []byte + Mweb *MwebTx } // AddTxIn adds a transaction input to the message. @@ -365,11 +364,10 @@ func (msg *MsgTx) TxHash() chainhash.Hash { // Ignore the error returns since the only way the encode could fail // is being out of memory or due to nil pointers, both of which would // cause a run-time panic. + // A pure-MW tx can only be in mempool or the EB, not the canonical block. - if len(msg.Kern0) > 0 && len(msg.TxIn) == 0 && len(msg.TxOut) == 0 { - // CTransaction::ComputeHash in src/primitives/transaction.cpp. - // Fortunately also a 32 byte hash so we can use chainhash.Hash. - return blake3.Sum256(msg.Kern0) + if msg.Mweb != nil && len(msg.TxIn) == 0 && len(msg.TxOut) == 0 { + return *msg.Mweb.TxBody.Kernels[0].Hash() } buf := bytes.NewBuffer(make([]byte, 0, msg.SerializeSizeStripped())) @@ -385,7 +383,7 @@ func (msg *MsgTx) TxHash() chainhash.Hash { func (msg *MsgTx) WitnessHash() chainhash.Hash { if msg.HasWitness() { buf := bytes.NewBuffer(make([]byte, 0, msg.SerializeSize())) - _ = msg.Serialize(buf) + _ = msg.BtcEncode(buf, 0, WitnessEncoding) return chainhash.DoubleHashH(buf.Bytes()) } @@ -395,75 +393,14 @@ func (msg *MsgTx) WitnessHash() chainhash.Hash { // Copy creates a deep copy of a transaction so that the original does not get // modified when the copy is manipulated. func (msg *MsgTx) Copy() *MsgTx { - // Create new tx and start by copying primitive values and making space - // for the transaction inputs and outputs. - newTx := MsgTx{ - Version: msg.Version, - TxIn: make([]*TxIn, 0, len(msg.TxIn)), - TxOut: make([]*TxOut, 0, len(msg.TxOut)), - LockTime: msg.LockTime, - } - - // Deep copy the old TxIn data. - for _, oldTxIn := range msg.TxIn { - // Deep copy the old previous outpoint. - oldOutPoint := oldTxIn.PreviousOutPoint - newOutPoint := OutPoint{} - newOutPoint.Hash.SetBytes(oldOutPoint.Hash[:]) - newOutPoint.Index = oldOutPoint.Index - - // Deep copy the old signature script. - var newScript []byte - oldScript := oldTxIn.SignatureScript - oldScriptLen := len(oldScript) - if oldScriptLen > 0 { - newScript = make([]byte, oldScriptLen) - copy(newScript, oldScript[:oldScriptLen]) - } - - // Create new txIn with the deep copied data. - newTxIn := TxIn{ - PreviousOutPoint: newOutPoint, - SignatureScript: newScript, - Sequence: oldTxIn.Sequence, - } - - // If the transaction is witnessy, then also copy the - // witnesses. - if len(oldTxIn.Witness) != 0 { - // Deep copy the old witness data. - newTxIn.Witness = make([][]byte, len(oldTxIn.Witness)) - for i, oldItem := range oldTxIn.Witness { - newItem := make([]byte, len(oldItem)) - copy(newItem, oldItem) - newTxIn.Witness[i] = newItem - } - } - - // Finally, append this fully copied txin. - newTx.TxIn = append(newTx.TxIn, &newTxIn) + var buf bytes.Buffer + if err := msg.Serialize(&buf); err != nil { + return nil } - - // Deep copy the old TxOut data. - for _, oldTxOut := range msg.TxOut { - // Deep copy the old PkScript - var newScript []byte - oldScript := oldTxOut.PkScript - oldScriptLen := len(oldScript) - if oldScriptLen > 0 { - newScript = make([]byte, oldScriptLen) - copy(newScript, oldScript[:oldScriptLen]) - } - - // Create new txOut with the deep copied data and append it to - // new Tx. - newTxOut := TxOut{ - Value: oldTxOut.Value, - PkScript: newScript, - } - newTx.TxOut = append(newTx.TxOut, &newTxOut) + var newTx MsgTx + if err := newTx.Deserialize(&buf); err != nil { + return nil } - return &newTx } @@ -487,7 +424,7 @@ func (msg *MsgTx) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error // value is a TxFlagMarker, and hence indicates the presence of a flag. hasMweb := false hasWitness := false - if count == TxFlagMarker && enc == WitnessEncoding { + if count == TxFlagMarker && enc != BaseEncoding { var flag [1]TxFlag // The count varint was in fact the flag marker byte. Next, we need to // read the flag value, which is a single byte. @@ -642,34 +579,30 @@ func (msg *MsgTx) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error } } - var kern0 []byte - var isHogEx bool if hasMweb { - dec := newDecoder(r) - kern0, isHogEx, err = dec.readMWTX() - if err != nil { + var hasMweb byte + if err = readElement(r, &hasMweb); err != nil { returnScriptBuffers() return err } + msg.IsHogEx = hasMweb == 0 - msg.IsHogEx = isHogEx - msg.Kern0 = kern0 - - if isHogEx && len(msg.TxOut) == 0 { + if !msg.IsHogEx { + msg.Mweb = &MwebTx{} + if err = msg.Mweb.read(r, pver); err != nil { + returnScriptBuffers() + return err + } + } else if len(msg.TxOut) == 0 { + returnScriptBuffers() return messageError("MsgTx.BtcDecode", "No outputs on HogEx transaction") } + } - msg.LockTime, err = binarySerializer.Uint32(r, littleEndian) - if err != nil { - returnScriptBuffers() - return err - } - } else { - msg.LockTime, err = binarySerializer.Uint32(r, littleEndian) - if err != nil { - returnScriptBuffers() - return err - } + msg.LockTime, err = binarySerializer.Uint32(r, littleEndian) + if err != nil { + returnScriptBuffers() + return err } // Create a single allocation to house all of the scripts and set each @@ -782,13 +715,21 @@ func (msg *MsgTx) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error // field for the MsgTx aren't 0x00, then this indicates the transaction // is to be encoded using the new witness inclusionary structure // defined in BIP0144. - doWitness := enc == WitnessEncoding && msg.HasWitness() - if doWitness { + doWitness := enc&WitnessEncoding > 0 && msg.HasWitness() + doMweb := enc&MwebEncoding > 0 && (msg.IsHogEx || msg.Mweb != nil) + if doWitness || doMweb { // After the transaction's Version field, we include two additional // bytes specific to the witness encoding. This byte sequence is known // as a flag. The first byte is a marker byte (TxFlagMarker) and the // second one is the flag value to indicate presence of witness data. - if _, err := w.Write([]byte{TxFlagMarker, WitnessFlag}); err != nil { + var flag TxFlag + if doWitness { + flag |= WitnessFlag + } + if doMweb { + flag |= MwebFlag + } + if _, err := w.Write([]byte{TxFlagMarker, flag}); err != nil { return err } } @@ -831,6 +772,21 @@ func (msg *MsgTx) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error } } + if doMweb { + if msg.IsHogEx { + err = writeElement(w, byte(0)) + } else { + err = writeElement(w, byte(1)) + if err != nil { + return err + } + err = msg.Mweb.write(w, pver) + } + if err != nil { + return err + } + } + return binarySerializer.PutUint32(w, littleEndian, msg.LockTime) } @@ -865,7 +821,7 @@ func (msg *MsgTx) Serialize(w io.Writer) error { // indicates that the transaction's witnesses (if any) should be // serialized according to the new serialization structure defined in // BIP0144. - return msg.BtcEncode(w, 0, WitnessEncoding) + return msg.BtcEncode(w, 0, LatestEncoding) } // SerializeNoWitness encodes the transaction to w in an identical manner to @@ -899,10 +855,13 @@ func (msg *MsgTx) baseSize() int { func (msg *MsgTx) SerializeSize() int { n := msg.baseSize() - if msg.HasWitness() { + isMweb := msg.IsHogEx || msg.Mweb != nil + if msg.HasWitness() || isMweb { // The marker, and flag fields take up two additional bytes. n += 2 + } + if msg.HasWitness() { // Additionally, factor in the serialized size of each of the // witnesses for each txin. for _, txin := range msg.TxIn { @@ -910,6 +869,15 @@ func (msg *MsgTx) SerializeSize() int { } } + if isMweb { + n++ // has mweb + if msg.Mweb != nil { + var buf bytes.Buffer + msg.Mweb.write(&buf, 0) + n += buf.Len() + } + } + return n } @@ -1116,281 +1084,3 @@ func writeTxWitness(w io.Writer, pver uint32, version int32, wit [][]byte) error } return nil } - -/// MWEB - -type decoder struct { - buf [8]byte - rd io.Reader - tee *bytes.Buffer // anything read from rd is Written to tee -} - -// decoders -func newDecoder(r io.Reader) *decoder { - return &decoder{rd: r} -} - -func (d *decoder) Read(b []byte) (n int, err error) { - n, err = d.rd.Read(b) - if err != nil { - return 0, err - } - if d.tee != nil { - d.tee.Write(b) - } - return n, nil -} - -func (d *decoder) readByte() (byte, error) { - b := d.buf[:1] - if _, err := io.ReadFull(d, b); err != nil { - return 0, err - } - return b[0], nil -} - -func (d *decoder) discardBytes(n int64) error { - m, err := io.CopyN(io.Discard, d, n) - if err != nil { - return err - } - if m != n { - return fmt.Errorf("only discarded %d of %d bytes", m, n) - } - return nil -} - -func (d *decoder) discardVect() error { - sz, err := ReadVarInt(d, 0) - if err != nil { - return err - } - return d.discardBytes(int64(sz)) -} - -func (d *decoder) readVLQ() (uint64, error) { - var n uint64 - for { - val, err := d.readByte() - if err != nil { - return 0, err - } - n = (n << 7) | uint64(val&0x7f) - if val&0x80 != 0x80 { - break - } - n++ - } - - return n, nil -} - -// reader -func (d *decoder) readMWTX() ([]byte, bool, error) { - // src/mweb/mweb_models.h - struct Tx - // "A convenience wrapper around a possibly-null MWEB transaction." - // Read the uint8_t is_set of OptionalPtr. - haveMWTX, err := d.readByte() - if err != nil { - return nil, false, err - } - if haveMWTX == 0 { - return nil, true, nil // HogEx - that's all folks - } - - // src/libmw/include/mw/models/tx/Transaction.h - class Transaction - // READWRITE(obj.m_kernelOffset); // class BlindingFactor - // READWRITE(obj.m_stealthOffset); // class BlindingFactor - // READWRITE(obj.m_body); // class TxBody - - // src/libmw/include/mw/models/crypto/BlindingFactor.h - class BlindingFactor - // just 32 bytes: - // BigInt<32> m_value; - // READWRITE(obj.m_value); - // x2 for both kernel_offset and stealth_offset BlindingFactor - if err = d.discardBytes(64); err != nil { - return nil, false, err - } - - // TxBody - kern0, err := d.readMWTXBody() - if err != nil { - return nil, false, err - } - return kern0, false, nil -} - -func (d *decoder) readMWTXBody() ([]byte, error) { - // src/libmw/include/mw/models/tx/TxBody.h - class TxBody - // READWRITE(obj.m_inputs, obj.m_outputs, obj.m_kernels); - // std::vector m_inputs; - // std::vector m_outputs; - // std::vector m_kernels; - - // inputs - numIn, err := ReadVarInt(d, 0) - if err != nil { - return nil, err - } - for i := 0; i < int(numIn); i++ { - // src/libmw/include/mw/models/tx/Input.h - class Input - // - features uint8_t - // - outputID mw::Hash - 32 bytes BigInt<32> - // - commit Commitment - 33 bytes BigInt for SIZE 33 - // - outputPubKey PublicKey - 33 bytes BigInt<33> - // (if features includes STEALTH_KEY_FEATURE_BIT) input_pubkey PublicKey - // (if features includes EXTRA_DATA_FEATURE_BIT) extraData vector - // - signature Signature - 64 bytes BigInt for SIZE 64 - // - // enum FeatureBit { - // STEALTH_KEY_FEATURE_BIT = 0x01, - // EXTRA_DATA_FEATURE_BIT = 0x02 - // }; - feats, err := d.readByte() - if err != nil { - return nil, err - } - if err = d.discardBytes(32 + 33 + 33); err != nil { // outputID, commitment, outputPubKey - return nil, err - } - if feats&0x1 != 0 { // input pubkey - if err = d.discardBytes(33); err != nil { - return nil, err - } - } - if feats&0x2 != 0 { // extraData - if err = d.discardVect(); err != nil { - return nil, err - } - } - if err = d.discardBytes(64); err != nil { // sig - return nil, err - } - } - - // outputs - numOut, err := ReadVarInt(d, 0) - if err != nil { - return nil, err - } - for i := 0; i < int(numOut); i++ { - // src/libmw/include/mw/models/tx/Output.h - class Output - // commit - // sender pubkey - // receiver pubkey - // message OutputMessage --- fuuuuuuuu - // proof RangeProof - // signature - if err = d.discardBytes(33 + 33 + 33); err != nil { // commitment, sender pk, receiver pk - return nil, err - } - - // OutputMessage - feats, err := d.readByte() - if err != nil { - return nil, err - } - // enum FeatureBit { - // STANDARD_FIELDS_FEATURE_BIT = 0x01, - // EXTRA_DATA_FEATURE_BIT = 0x02 - // }; - if feats&0x1 != 0 { // pubkey | view_tag uint8_t | masked_value uint64_t | nonce 16-bytes - if err = d.discardBytes(33 + 1 + 8 + 16); err != nil { - return nil, err - } - } - if feats&0x2 != 0 { // extraData - if err = d.discardVect(); err != nil { - return nil, err - } - } - - // RangeProof "The proof itself, at most 675 bytes long." - // std::vector m_bytes; -- except it's actually used like a [675]byte... - if err = d.discardBytes(675 + 64); err != nil { // proof + sig - return nil, err - } - } - - // kernels - numKerns, err := ReadVarInt(d, 0) - if err != nil { - return nil, err - } - // Capture the first kernel since pure MW txns (no canonical inputs or - // outputs) that live in the MWEB but are also seen in mempool have their - // hash computed as blake3_256(kernel0). - var kern0 []byte - d.tee = new(bytes.Buffer) - for i := 0; i < int(numKerns); i++ { - // src/libmw/include/mw/models/tx/Kernel.h - class Kernel - - // enum FeatureBit { - // FEE_FEATURE_BIT = 0x01, - // PEGIN_FEATURE_BIT = 0x02, - // PEGOUT_FEATURE_BIT = 0x04, - // HEIGHT_LOCK_FEATURE_BIT = 0x08, - // STEALTH_EXCESS_FEATURE_BIT = 0x10, - // EXTRA_DATA_FEATURE_BIT = 0x20, - // ALL_FEATURE_BITS = FEE_FEATURE_BIT | PEGIN... - // }; - feats, err := d.readByte() - if err != nil { - return nil, err - } - if feats&0x1 != 0 { // fee - _, err = d.readVLQ() // vlq for amount? in the wire protocol?!? - if err != nil { - return nil, err - } - } - if feats&0x2 != 0 { // pegin amt - _, err = d.readVLQ() - if err != nil { - return nil, err - } - } - if feats&0x4 != 0 { // pegouts vector - sz, err := ReadVarInt(d, 0) - if err != nil { - return nil, err - } - for i := uint64(0); i < sz; i++ { - _, err = d.readVLQ() // pegout amt - if err != nil { - return nil, err - } - if err = d.discardVect(); err != nil { // pkScript - return nil, err - } - } - } - if feats&0x8 != 0 { // lockHeight - _, err = d.readVLQ() - if err != nil { - return nil, err - } - } - if feats&0x10 != 0 { // stealth_excess pubkey - if err = d.discardBytes(33); err != nil { - return nil, err - } - } - if feats&0x20 != 0 { // extraData vector - if err = d.discardVect(); err != nil { - return nil, err - } - } - // "excess" commitment and signature - if err = d.discardBytes(33 + 64); err != nil { - return nil, err - } - - if i == 0 { - kern0 = d.tee.Bytes() - d.tee = nil - } - } - - return kern0, nil -} diff --git a/wire/msgtx_test.go b/wire/msgtx_test.go index a1df2622ec..f99b465b63 100644 --- a/wire/msgtx_test.go +++ b/wire/msgtx_test.go @@ -13,7 +13,7 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ltcsuite/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/chaincfg/chainhash" "github.com/stretchr/testify/require" "gotest.tools/assert" ) diff --git a/wire/mwebheader.go b/wire/mwebheader.go new file mode 100644 index 0000000000..15c62ff204 --- /dev/null +++ b/wire/mwebheader.go @@ -0,0 +1,125 @@ +// Copyright (c) 2024 The ltcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package wire + +import ( + "errors" + "io" + "math" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "lukechampine.com/blake3" +) + +// The MWEB header struct +type MwebHeader struct { + Height int32 + OutputRoot chainhash.Hash + KernelRoot chainhash.Hash + LeafsetRoot chainhash.Hash + KernelOffset chainhash.Hash + StealthOffset chainhash.Hash + OutputMMRSize uint64 + KernelMMRSize uint64 +} + +// Read the Litecoin-internal VarInt encoding +func readVarInt(r io.Reader) (n uint64, err error) { + var buf [1]byte + for { + if _, err = r.Read(buf[:]); err != nil { + return + } + if n > math.MaxUint64>>7 { + return n, errors.New("size too large") + } + n = n<<7 | uint64(buf[0]&0x7f) + if buf[0]&0x80 == 0 { + return + } + if n == math.MaxUint64 { + return n, errors.New("size too large") + } + n++ + } +} + +// Write the Litecoin-internal VarInt encoding +func writeVarInt(w io.Writer, n uint64) error { + var buf [10]byte + i := 0 + for ; ; i++ { + buf[i] = byte(n & 0x7f) + if i > 0 { + buf[i] |= 0x80 + } + if n < 0x80 { + break + } + n = (n >> 7) - 1 + } + for ; i >= 0; i-- { + if _, err := w.Write(buf[i : i+1]); err != nil { + return err + } + } + return nil +} + +// Reads a litecoin mweb header from r. See Deserialize for +// decoding mweb headers stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (mh *MwebHeader) read(r io.Reader) error { + n, err := readVarInt(r) + if err != nil { + return err + } + mh.Height = int32(n) + + err = readElements(r, &mh.OutputRoot, &mh.KernelRoot, + &mh.LeafsetRoot, &mh.KernelOffset, &mh.StealthOffset) + if err != nil { + return err + } + + mh.OutputMMRSize, err = readVarInt(r) + if err != nil { + return err + } + + mh.KernelMMRSize, err = readVarInt(r) + return err +} + +// Writes a litecoin mweb header to w. See Serialize for +// encoding mweb headers to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (mh *MwebHeader) write(w io.Writer) error { + err := writeVarInt(w, uint64(mh.Height)) + if err != nil { + return err + } + + err = writeElements(w, &mh.OutputRoot, &mh.KernelRoot, + &mh.LeafsetRoot, &mh.KernelOffset, &mh.StealthOffset) + if err != nil { + return err + } + + err = writeVarInt(w, mh.OutputMMRSize) + if err != nil { + return err + } + + err = writeVarInt(w, mh.KernelMMRSize) + return err +} + +// Hash of the mweb header +func (mh *MwebHeader) Hash() *chainhash.Hash { + h := blake3.New(32, nil) + mh.write(h) + return (*chainhash.Hash)(h.Sum(nil)) +} diff --git a/wire/mwebinput.go b/wire/mwebinput.go new file mode 100644 index 0000000000..8cb1ffe66b --- /dev/null +++ b/wire/mwebinput.go @@ -0,0 +1,103 @@ +package wire + +import ( + "io" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "lukechampine.com/blake3" +) + +const ( + MwebInputStealthKeyFeatureBit MwebInputFeatureBit = 0x1 + MwebInputExtraDataFeatureBit MwebInputFeatureBit = 0x2 +) + +type ( + MwebInputFeatureBit byte + + MwebInput struct { + Features MwebInputFeatureBit + OutputId chainhash.Hash + Commitment mw.Commitment + InputPubKey *mw.PublicKey + OutputPubKey mw.PublicKey + ExtraData []byte + Signature mw.Signature + } +) + +func (mi *MwebInput) Hash() *chainhash.Hash { + h := blake3.New(32, nil) + mi.write(h, 0) + return (*chainhash.Hash)(h.Sum(nil)) +} + +// Reads a litecoin mweb input from r. See Deserialize for +// decoding mweb inputs stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (mi *MwebInput) read(r io.Reader, pver uint32) error { + err := readElements(r, &mi.Features, &mi.OutputId, + mi.Commitment[:], mi.OutputPubKey[:]) + if err != nil { + return err + } + + if mi.Features&MwebInputStealthKeyFeatureBit > 0 { + mi.InputPubKey = new(mw.PublicKey) + if _, err = io.ReadFull(r, mi.InputPubKey[:]); err != nil { + return err + } + } + + if mi.Features&MwebInputExtraDataFeatureBit > 0 { + mi.ExtraData, err = ReadVarBytes(r, pver, MaxMessagePayload, "ExtraData") + if err != nil { + return err + } + } + + _, err = io.ReadFull(r, mi.Signature[:]) + return err +} + +// Writes a litecoin mweb input to w. See Serialize for +// encoding mweb inputs to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (mi *MwebInput) write(w io.Writer, pver uint32) error { + err := writeElements(w, mi.Features, &mi.OutputId, + mi.Commitment[:], mi.OutputPubKey[:]) + if err != nil { + return err + } + + if mi.Features&MwebInputStealthKeyFeatureBit > 0 { + if _, err = w.Write(mi.InputPubKey[:]); err != nil { + return err + } + } + + if mi.Features&MwebInputExtraDataFeatureBit > 0 { + if err = WriteVarBytes(w, pver, mi.ExtraData); err != nil { + return err + } + } + + _, err = w.Write(mi.Signature[:]) + return err +} + +func (mi *MwebInput) VerifySig() bool { + defer func() { recover() }() + + h := blake3.New(32, nil) + h.Write(mi.InputPubKey[:]) + h.Write(mi.OutputPubKey[:]) + keyHash := (*mw.SecretKey)(h.Sum(nil)) + pubKey := mi.OutputPubKey.Mul(keyHash).Add(mi.InputPubKey) + + h.Reset() + h.Write([]byte{byte(mi.Features)}) + h.Write(mi.OutputId[:]) + return mi.Signature.Verify(pubKey, h.Sum(nil)) +} diff --git a/wire/mwebkernel.go b/wire/mwebkernel.go new file mode 100644 index 0000000000..bebf1687a6 --- /dev/null +++ b/wire/mwebkernel.go @@ -0,0 +1,210 @@ +package wire + +import ( + "bytes" + "errors" + "io" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "lukechampine.com/blake3" +) + +const ( + MwebKernelFeeFeatureBit MwebKernelFeatureBit = 1 << iota + MwebKernelPeginFeatureBit + MwebKernelPegoutFeatureBit + MwebKernelHeightLockFeatureBit + MwebKernelStealthExcessFeatureBit + MwebKernelExtraDataFeatureBit + + MwebKernelAllFeatureBits = MwebKernelFeeFeatureBit | + MwebKernelPeginFeatureBit | MwebKernelPegoutFeatureBit | + MwebKernelHeightLockFeatureBit | MwebKernelStealthExcessFeatureBit | + MwebKernelExtraDataFeatureBit +) + +type ( + MwebKernelFeatureBit byte + + MwebKernel struct { + Features MwebKernelFeatureBit + Fee uint64 + Pegin uint64 + Pegouts []*TxOut + LockHeight int32 + StealthExcess mw.PublicKey + ExtraData []byte + Excess mw.Commitment + Signature mw.Signature + } +) + +func (mk *MwebKernel) Hash() *chainhash.Hash { + h := blake3.New(32, nil) + mk.write(h, 0, false) + return (*chainhash.Hash)(h.Sum(nil)) +} + +func (mk *MwebKernel) Message() []byte { + var buf bytes.Buffer + mk.write(&buf, 0, true) + return buf.Bytes() +} + +func (mk *MwebKernel) MessageHash() *chainhash.Hash { + h := blake3.New(32, nil) + mk.write(h, 0, true) + return (*chainhash.Hash)(h.Sum(nil)) +} + +func (mk *MwebKernel) SupplyChange() int64 { + n := int64(mk.Pegin) - int64(mk.Fee) + for _, pegout := range mk.Pegouts { + n -= pegout.Value + } + return n +} + +// Reads a litecoin mweb kernel from r. See Deserialize for +// decoding mweb kernels stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (mk *MwebKernel) read(r io.Reader, pver uint32) error { + err := readElement(r, &mk.Features) + if err != nil { + return err + } + + if mk.Features&MwebKernelFeeFeatureBit > 0 { + if mk.Fee, err = readVarInt(r); err != nil { + return err + } + } + + if mk.Features&MwebKernelPeginFeatureBit > 0 { + if mk.Pegin, err = readVarInt(r); err != nil { + return err + } + } + + if mk.Features&MwebKernelPegoutFeatureBit > 0 { + var count uint64 + if count, err = ReadVarInt(r, pver); err != nil { + return err + } + if count > maxTxOutPerMessage { + return errors.New("too many pegouts") + } + mk.Pegouts = make([]*TxOut, count) + for i := range mk.Pegouts { + mk.Pegouts[i] = &TxOut{} + if value, err := readVarInt(r); err == nil { + mk.Pegouts[i].Value = int64(value) + } else { + return err + } + mk.Pegouts[i].PkScript, err = readScript(r, pver, + MaxMessagePayload, "public key script") + if err != nil { + return err + } + } + } + + if mk.Features&MwebKernelHeightLockFeatureBit > 0 { + var lockHeight uint64 + if lockHeight, err = readVarInt(r); err != nil { + return err + } + mk.LockHeight = int32(lockHeight) + } + + if mk.Features&MwebKernelStealthExcessFeatureBit > 0 { + if _, err = io.ReadFull(r, mk.StealthExcess[:]); err != nil { + return err + } + } + + if mk.Features&MwebKernelExtraDataFeatureBit > 0 { + mk.ExtraData, err = ReadVarBytes(r, pver, MaxMessagePayload, "ExtraData") + if err != nil { + return err + } + } + + return readElements(r, mk.Excess[:], mk.Signature[:]) +} + +// Writes a litecoin mweb kernel to w. See Serialize for +// encoding mweb kernels to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (mk *MwebKernel) write(w io.Writer, pver uint32, message bool) error { + err := writeElements(w, mk.Features) + if err != nil { + return err + } + + if message { + if _, err = w.Write(mk.Excess[:]); err != nil { + return err + } + } + + if mk.Features&MwebKernelFeeFeatureBit > 0 { + if err = writeVarInt(w, mk.Fee); err != nil { + return err + } + } + + if mk.Features&MwebKernelPeginFeatureBit > 0 { + if err = writeVarInt(w, mk.Pegin); err != nil { + return err + } + } + + if mk.Features&MwebKernelPegoutFeatureBit > 0 { + if err = WriteVarInt(w, pver, uint64(len(mk.Pegouts))); err != nil { + return err + } + for _, out := range mk.Pegouts { + if err = writeVarInt(w, uint64(out.Value)); err != nil { + return err + } + if err = WriteVarBytes(w, pver, out.PkScript); err != nil { + return err + } + } + } + + if mk.Features&MwebKernelHeightLockFeatureBit > 0 { + if err = writeVarInt(w, uint64(mk.LockHeight)); err != nil { + return err + } + } + + if mk.Features&MwebKernelStealthExcessFeatureBit > 0 { + if _, err = w.Write(mk.StealthExcess[:]); err != nil { + return err + } + } + + if mk.Features&MwebKernelExtraDataFeatureBit > 0 { + if err = WriteVarBytes(w, pver, mk.ExtraData); err != nil { + return err + } + } + + if message { + return nil + } + + return writeElements(w, mk.Excess[:], mk.Signature[:]) +} + +func (mk *MwebKernel) Serialize(w io.Writer) error { + return mk.write(w, 0, false) +} + +func (mk *MwebKernel) Deserialize(r io.Reader) error { + return mk.read(r, 0) +} diff --git a/wire/mweboutput.go b/wire/mweboutput.go new file mode 100644 index 0000000000..4134622267 --- /dev/null +++ b/wire/mweboutput.go @@ -0,0 +1,243 @@ +package wire + +import ( + "bytes" + "io" + "math/big" + + "github.com/ltcmweb/ltcd/chaincfg/chainhash" + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" + "github.com/ltcmweb/secp256k1" + "lukechampine.com/blake3" +) + +const ( + MwebOutputMessageStandardFieldsFeatureBit MwebOutputMessageFeatureBit = 0x1 + MwebOutputMessageExtraDataFeatureBit MwebOutputMessageFeatureBit = 0x2 +) + +type ( + MwebOutputMessageFeatureBit byte + + MwebOutputMessage struct { + Features MwebOutputMessageFeatureBit + KeyExchangePubKey mw.PublicKey + ViewTag byte + MaskedValue uint64 + MaskedNonce big.Int + ExtraData []byte + } + + MwebOutput struct { + Commitment mw.Commitment + SenderPubKey mw.PublicKey + ReceiverPubKey mw.PublicKey + Message MwebOutputMessage + RangeProof *secp256k1.RangeProof + RangeProofHash chainhash.Hash + Signature mw.Signature + + hash *chainhash.Hash + } +) + +func (om *MwebOutputMessage) Hash() *chainhash.Hash { + h := blake3.New(32, nil) + om.write(h, 0) + return (*chainhash.Hash)(h.Sum(nil)) +} + +func (mo *MwebOutput) Hash() *chainhash.Hash { + if mo.hash != nil { + return mo.hash + } + h := blake3.New(32, nil) + mo.write(h, 0, true, true) + mo.hash = (*chainhash.Hash)(h.Sum(nil)) + return mo.hash +} + +// Reads a litecoin mweb output message from r. See Deserialize for +// decoding mweb output messages stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (om *MwebOutputMessage) read(r io.Reader, pver uint32) error { + err := readElement(r, &om.Features) + if err != nil { + return err + } + + if om.Features&MwebOutputMessageStandardFieldsFeatureBit > 0 { + if _, err = io.ReadFull(r, om.KeyExchangePubKey[:]); err != nil { + return err + } + if err = readElements(r, &om.ViewTag, &om.MaskedValue); err != nil { + return err + } + var maskedNonce [16]byte + if _, err = io.ReadFull(r, maskedNonce[:]); err != nil { + return err + } + om.MaskedNonce.SetBytes(maskedNonce[:]) + } + + if om.Features&MwebOutputMessageExtraDataFeatureBit > 0 { + om.ExtraData, err = ReadVarBytes(r, pver, MaxMessagePayload, "ExtraData") + if err != nil { + return err + } + } + + return err +} + +// Writes a litecoin mweb output message to w. See Serialize for +// encoding mweb output messages to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (om *MwebOutputMessage) write(w io.Writer, pver uint32) error { + err := writeElement(w, om.Features) + if err != nil { + return err + } + + if om.Features&MwebOutputMessageStandardFieldsFeatureBit > 0 { + if _, err = w.Write(om.KeyExchangePubKey[:]); err != nil { + return err + } + if err = writeElements(w, om.ViewTag, om.MaskedValue); err != nil { + return err + } + var maskedNonce [16]byte + om.MaskedNonce.FillBytes(maskedNonce[:]) + if _, err = w.Write(maskedNonce[:]); err != nil { + return err + } + } + + if om.Features&MwebOutputMessageExtraDataFeatureBit > 0 { + if err = WriteVarBytes(w, pver, om.ExtraData); err != nil { + return err + } + } + + return err +} + +func (om *MwebOutputMessage) Serialize(w io.Writer) error { + return om.write(w, 0) +} + +func (om *MwebOutputMessage) Deserialize(r io.Reader) error { + return om.read(r, 0) +} + +// Reads a litecoin mweb output from r. See Deserialize for +// decoding mweb outputs stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (mo *MwebOutput) read(r io.Reader, pver uint32, compact bool) error { + _, err := io.ReadFull(r, mo.Commitment[:]) + if err != nil { + return err + } + + _, err = io.ReadFull(r, mo.SenderPubKey[:]) + if err != nil { + return err + } + + _, err = io.ReadFull(r, mo.ReceiverPubKey[:]) + if err != nil { + return err + } + + err = mo.Message.read(r, pver) + if err != nil { + return err + } + + err = readElement(r, &mo.RangeProofHash) + if err != nil { + return err + } + + if !compact { + if bytes.Count(mo.RangeProofHash[:], []byte{0}) == 32 { + err = readElement(r, &mo.RangeProofHash) + } else { + mo.RangeProof = &secp256k1.RangeProof{} + copy(mo.RangeProof[:], mo.RangeProofHash[:]) + _, err = io.ReadFull(r, mo.RangeProof[32:]) + mo.RangeProofHash = blake3.Sum256(mo.RangeProof[:]) + } + if err != nil { + return err + } + } + + _, err = io.ReadFull(r, mo.Signature[:]) + return err +} + +// Writes a litecoin mweb output to w. See Serialize for +// encoding mweb outputs to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (mo *MwebOutput) write(w io.Writer, pver uint32, compact, hashing bool) error { + _, err := w.Write(mo.Commitment[:]) + if err != nil { + return err + } + + _, err = w.Write(mo.SenderPubKey[:]) + if err != nil { + return err + } + + _, err = w.Write(mo.ReceiverPubKey[:]) + if err != nil { + return err + } + + if hashing { + h := mo.Message.Hash() + _, err = w.Write(h[:]) + } else { + err = mo.Message.write(w, pver) + } + if err != nil { + return err + } + + if compact || hashing { + err = writeElement(w, &mo.RangeProofHash) + } else if mo.RangeProof != nil { + _, err = w.Write(mo.RangeProof[:]) + } else { + if _, err = w.Write(make([]byte, 32)); err != nil { + return err + } + err = writeElement(w, &mo.RangeProofHash) + } + if err != nil { + return err + } + + _, err = w.Write(mo.Signature[:]) + return err +} + +func (mo *MwebOutput) Serialize(w io.Writer) error { + return mo.write(w, 0, false, false) +} + +func (mo *MwebOutput) Deserialize(r io.Reader) error { + return mo.read(r, 0, false) +} + +func (mo *MwebOutput) VerifySig() bool { + h := blake3.New(32, nil) + h.Write(mo.Commitment[:]) + h.Write(mo.SenderPubKey[:]) + h.Write(mo.ReceiverPubKey[:]) + h.Write(mo.Message.Hash()[:]) + h.Write(mo.RangeProofHash[:]) + return mo.Signature.Verify(&mo.SenderPubKey, h.Sum(nil)) +} diff --git a/wire/mwebtx.go b/wire/mwebtx.go new file mode 100644 index 0000000000..737ffc9c48 --- /dev/null +++ b/wire/mwebtx.go @@ -0,0 +1,158 @@ +package wire + +import ( + "errors" + "io" + "math/big" + "sort" + + "github.com/ltcmweb/ltcd/ltcutil/mweb/mw" +) + +type ( + MwebTxBody struct { + Inputs []*MwebInput + Outputs []*MwebOutput + Kernels []*MwebKernel + } + + MwebTx struct { + KernelOffset mw.BlindingFactor + StealthOffset mw.BlindingFactor + TxBody *MwebTxBody + } +) + +func (tb *MwebTxBody) Sort() { + sort.Slice(tb.Inputs, func(i, j int) bool { + a := new(big.Int).SetBytes(tb.Inputs[i].OutputId[:]) + b := new(big.Int).SetBytes(tb.Inputs[j].OutputId[:]) + return a.Cmp(b) < 0 + }) + sort.Slice(tb.Outputs, func(i, j int) bool { + a := new(big.Int).SetBytes(tb.Outputs[i].Hash()[:]) + b := new(big.Int).SetBytes(tb.Outputs[j].Hash()[:]) + return a.Cmp(b) < 0 + }) + sort.Slice(tb.Kernels, func(i, j int) bool { + da := tb.Kernels[i].SupplyChange() + db := tb.Kernels[j].SupplyChange() + a := new(big.Int).SetBytes(tb.Kernels[i].Hash()[:]) + b := new(big.Int).SetBytes(tb.Kernels[j].Hash()[:]) + return da > db || da == db && a.Cmp(b) < 0 + }) +} + +// Reads a litecoin mweb txbody from r. See Deserialize for +// decoding mweb txbodys stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (tb *MwebTxBody) read(r io.Reader, pver uint32) (err error) { + var count uint64 + + if count, err = ReadVarInt(r, pver); err != nil { + return + } + if count > maxTxInPerMessage { + return errors.New("too many inputs") + } + tb.Inputs = make([]*MwebInput, count) + for i := range tb.Inputs { + tb.Inputs[i] = &MwebInput{} + if err = tb.Inputs[i].read(r, pver); err != nil { + return + } + } + + if count, err = ReadVarInt(r, pver); err != nil { + return + } + if count > maxTxOutPerMessage { + return errors.New("too many outputs") + } + tb.Outputs = make([]*MwebOutput, count) + for i := range tb.Outputs { + tb.Outputs[i] = &MwebOutput{} + if err = tb.Outputs[i].read(r, pver, false); err != nil { + return + } + } + + if count, err = ReadVarInt(r, pver); err != nil { + return + } + if count > maxTxPerBlock { + return errors.New("too many kernels") + } + tb.Kernels = make([]*MwebKernel, count) + for i := range tb.Kernels { + tb.Kernels[i] = &MwebKernel{} + if err = tb.Kernels[i].read(r, pver); err != nil { + return + } + } + + return +} + +// Writes a litecoin mweb txbody to w. See Serialize for +// encoding mweb txbodys to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (tb *MwebTxBody) write(w io.Writer, pver uint32) (err error) { + if err = WriteVarInt(w, pver, uint64(len(tb.Inputs))); err != nil { + return + } + for i := range tb.Inputs { + if err = tb.Inputs[i].write(w, pver); err != nil { + return + } + } + + if err = WriteVarInt(w, pver, uint64(len(tb.Outputs))); err != nil { + return + } + for i := range tb.Outputs { + if err = tb.Outputs[i].write(w, pver, false, false); err != nil { + return + } + } + + if err = WriteVarInt(w, pver, uint64(len(tb.Kernels))); err != nil { + return + } + for i := range tb.Kernels { + if err = tb.Kernels[i].write(w, pver, false); err != nil { + return + } + } + + return +} + +// Reads a litecoin mweb tx from r. See Deserialize for +// decoding mweb txns stored to disk, such as in a database, +// as opposed to decoding from the wire. +func (tx *MwebTx) read(r io.Reader, pver uint32) error { + err := readElements(r, tx.KernelOffset[:], tx.StealthOffset[:]) + if err != nil { + return err + } + tx.TxBody = &MwebTxBody{} + if err = tx.TxBody.read(r, pver); err != nil { + return err + } + if len(tx.TxBody.Kernels) < 1 { + return errors.New("transaction requires at least one kernel") + } + return nil +} + +// Writes a litecoin mweb tx to w. See Serialize for +// encoding mweb txns to be stored to disk, such as in +// a database, as opposed to encoding for the wire. +func (tx *MwebTx) write(w io.Writer, pver uint32) error { + err := writeElements(w, tx.KernelOffset[:], tx.StealthOffset[:]) + if err != nil { + return err + } + return tx.TxBody.write(w, pver) +} diff --git a/wire/protocol.go b/wire/protocol.go index ab6acc1a6e..473cfe2a3d 100644 --- a/wire/protocol.go +++ b/wire/protocol.go @@ -58,6 +58,10 @@ const ( // new messages that occur during the version-verack handshake will not // come with a protocol version bump. AddrV2Version uint32 = 70016 + + // MwebLightClientVersion is the protocol version which added four new messages. + // These are getmwebutxos, mwebutxos, mwebheader and mwebleafset. + MwebLightClientVersion uint32 = 70017 ) // ServiceFlag identifies services supported by a litecoin peer. @@ -87,19 +91,24 @@ const ( // the last 288 blocks. SFNodeNetworkLimited = 1 << 10 - // SFNodeMWEB is a flag used to indicate a peer support MWEB blocks + // SFNodeMWEBLightClient is a flag used to indicate a peer supports + // serving MWEB light client data. + SFNodeMWEBLightClient = 1 << 23 + + // SFNodeMWEB is a flag used to indicate a peer support MWEB blocks. SFNodeMWEB = 1 << 24 ) // Map of service flags back to their constant names for pretty printing. var sfStrings = map[ServiceFlag]string{ - SFNodeNetwork: "SFNodeNetwork", - SFNodeGetUTXO: "SFNodeGetUTXO", - SFNodeBloom: "SFNodeBloom", - SFNodeWitness: "SFNodeWitness", - SFNodeCF: "SFNodeCF", - SFNodeNetworkLimited: "SFNodeNetworkLimited", - SFNodeMWEB: "SFNodeMWEB", + SFNodeNetwork: "SFNodeNetwork", + SFNodeGetUTXO: "SFNodeGetUTXO", + SFNodeBloom: "SFNodeBloom", + SFNodeWitness: "SFNodeWitness", + SFNodeCF: "SFNodeCF", + SFNodeNetworkLimited: "SFNodeNetworkLimited", + SFNodeMWEBLightClient: "SFNodeMWEBLightClient", + SFNodeMWEB: "SFNodeMWEB", } // orderedSFStrings is an ordered list of service flags from highest to @@ -111,6 +120,7 @@ var orderedSFStrings = []ServiceFlag{ SFNodeWitness, SFNodeCF, SFNodeNetworkLimited, + SFNodeMWEBLightClient, SFNodeMWEB, } diff --git a/wire/protocol_test.go b/wire/protocol_test.go index 0dba8880ad..52afffc253 100644 --- a/wire/protocol_test.go +++ b/wire/protocol_test.go @@ -19,7 +19,7 @@ func TestServiceFlagStringer(t *testing.T) { {SFNodeWitness, "SFNodeWitness"}, {SFNodeCF, "SFNodeCF"}, {SFNodeNetworkLimited, "SFNodeNetworkLimited"}, - {0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|SFNodeCF|SFNodeNetworkLimited|SFNodeMWEB|0xfefffbb0"}, + {0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|SFNodeCF|SFNodeNetworkLimited|SFNodeMWEB|SFNodeMWEBLightClient|0xfcfffbb0"}, } t.Logf("Running %d tests", len(tests))