main: Update to use all new major module versions.

This updates all code in the main module to use the latest major modules
versions to pull in the latest updates.

A more general high level overview of the changes is provided below,
however, there is one semantic change worth calling out independently.

The verifymessage RPC will now return an error when provided with
an address that is not for the current active network and the RPC server
version has been bumped accordingly.

Previously, it would return false which indicated the signature is
invalid, even when the provided signature was actually valid for the
other network.  Said behavior was not really incorrect since the
address, signature, and message combination is in fact invalid for the
current active network, however, that result could be somewhat
misleading since a false result could easily be interpreted to mean the
signature is actually invalid altogether which is distinct from the case
of the address being for a different network.  Therefore, it is
preferable to explicitly return an error in the case of an address on
the wrong network to cleanly separate these cases.

The following is a high level overview of the changes:

- Replace all calls to removed blockchain merkle root, pow, subsidy, and
  coinbase funcs with their standalone module equivalents
  - Introduce a new local func named calcTxTreeMerkleRoot that accepts
    dcrutil.Tx as before and defers to the new standalone func
- Update block locator handling to match the new signature required by
  the peer/v2 module
  - Introduce a new local func named chainBlockLocatorToHashes which
    performs the necessary conversion
- Update all references to old v1 chaincfg params global instances to
  use the new v2 functions
- Modify all cases that parse addresses to provide the now required
  current network params
  - Include address params with the wsClientFilter
- Replace removed v1 chaincfg constants with local constants
- Create subsidy cache during server init and pass it to the relevant
  subsystems
  - blockManagerConfig
  - BlkTmplGenerator
  - rpcServer
  - VotingWallet
- Update mining code that creates the block one coinbase transaction to
  create the output scripts as defined in the v2 params
- Replace old v2 dcrjson constant references with new types module
- Fix various comment typos
- Update fees module to use the latest major module versions and bump it v2
This commit is contained in:
Dave Collins 2019-08-13 10:50:53 -05:00
parent e54dde10e9
commit 25c14e046a
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2
40 changed files with 442 additions and 533 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -8,7 +8,7 @@ import (
"sync"
"time"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/slog"
)

View File

@ -16,14 +16,15 @@ import (
"sync/atomic"
"time"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/fees"
"github.com/decred/dcrd/mempool/v2"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/database/v2"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/fees/v2"
"github.com/decred/dcrd/mempool/v3"
"github.com/decred/dcrd/wire"
)
@ -321,6 +322,7 @@ type blockManagerConfig struct {
// The following fields are for accessing the chain and its configuration.
Chain *blockchain.BlockChain
ChainParams *chaincfg.Params
SubsidyCache *standalone.SubsidyCache
// The following fields provide access to the fee estimator, mempool and
// the background block template generator.
@ -433,6 +435,20 @@ func (b *blockManager) findNextHeaderCheckpoint(height int64) *chaincfg.Checkpoi
return nextCheckpoint
}
// chainBlockLocatorToHashes converts a block locator from chain to a slice
// of hashes.
func chainBlockLocatorToHashes(locator blockchain.BlockLocator) []chainhash.Hash {
if len(locator) == 0 {
return nil
}
result := make([]chainhash.Hash, 0, len(locator))
for _, hash := range locator {
result = append(result, *hash)
}
return result
}
// startSync will choose the best peer among the available candidate peers to
// download/sync the blockchain from. When syncing is already running, it
// simply returns. It also examines the candidates for any which are no longer
@ -477,12 +493,13 @@ func (b *blockManager) startSync(peers *list.List) {
// to send.
b.requestedBlocks = make(map[chainhash.Hash]struct{})
locator, err := b.chain.LatestBlockLocator()
blkLocator, err := b.chain.LatestBlockLocator()
if err != nil {
bmgrLog.Errorf("Failed to get block locator for the "+
"latest block: %v", err)
return
}
locator := chainBlockLocatorToHashes(blkLocator)
bmgrLog.Infof("Syncing to block height %d from peer %v",
bestPeer.LastBlock(), bestPeer.Addr())
@ -542,8 +559,8 @@ func (b *blockManager) isSyncCandidate(sp *serverPeer) bool {
return sp.Services()&wire.SFNodeNetwork == wire.SFNodeNetwork
}
// syncMiningStateAfterSync polls the blockMananger for the current sync
// state; if the mananger is synced, it executes a call to the peer to
// syncMiningStateAfterSync polls the blockManager for the current sync
// state; if the manager is synced, it executes a call to the peer to
// sync the mining state to the network.
func (b *blockManager) syncMiningStateAfterSync(sp *serverPeer) {
go func() {
@ -716,12 +733,32 @@ func (b *blockManager) current() bool {
return true
}
// calcTxTreeMerkleRoot calculates and returns the merkle root for the provided
// transactions. The full (including witness data) hashes for the transactions
// are used as required for merkle roots.
func calcTxTreeMerkleRoot(transactions []*dcrutil.Tx) chainhash.Hash {
if len(transactions) == 0 {
// All zero.
return chainhash.Hash{}
}
// Note that the backing array is provided with space for one additional
// item when the number of leaves is odd as an optimization for the in-place
// calculation to avoid the need grow the backing array.
allocLen := len(transactions) + len(transactions)&1
leaves := make([]chainhash.Hash, 0, allocLen)
for _, tx := range transactions {
leaves = append(leaves, tx.MsgTx().TxHashFull())
}
return standalone.CalcMerkleRootInPlace(leaves)
}
// checkBlockForHiddenVotes checks to see if a newly added block contains
// any votes that were previously unknown to our daemon. If it does, it
// adds these votes to the cached parent block template.
//
// This is UNSAFE for concurrent access. It must be called in single threaded
// access through the block mananger. All template access must also be routed
// access through the block manager. All template access must also be routed
// through the block manager.
func (b *blockManager) checkBlockForHiddenVotes(block *dcrutil.Block) {
// Identify the cached parent template; it's possible that
@ -855,7 +892,7 @@ func (b *blockManager) checkBlockForHiddenVotes(block *dcrutil.Block) {
"block with extra found voters")
return
}
coinbase, err := createCoinbaseTx(b.chain.FetchSubsidyCache(),
coinbase, err := createCoinbaseTx(b.cfg.SubsidyCache,
template.Block.Transactions[0].TxIn[0].SignatureScript,
opReturnPkScript, int64(template.Block.Header.Height),
cfg.miningAddrs[rand.Intn(len(cfg.miningAddrs))],
@ -880,11 +917,10 @@ func (b *blockManager) checkBlockForHiddenVotes(block *dcrutil.Block) {
tx := dcrutil.NewTx(mtx)
updatedTxTreeRegular = append(updatedTxTreeRegular, tx)
}
merkles := blockchain.BuildMerkleTreeStore(updatedTxTreeRegular)
template.Block.Header.StakeRoot = *merkles[len(merkles)-1]
smerkles := blockchain.BuildMerkleTreeStore(updatedTxTreeStake)
template.Block.Header.StakeRoot = calcTxTreeMerkleRoot(updatedTxTreeRegular)
template.Block.Header.Voters = uint16(votesTotal)
template.Block.Header.StakeRoot = *smerkles[len(smerkles)-1]
template.Block.Header.StakeRoot = calcTxTreeMerkleRoot(updatedTxTreeStake)
template.Block.Header.Size = uint32(template.Block.SerializeSize())
}
@ -959,14 +995,14 @@ func (b *blockManager) handleBlockMsg(bmsg *blockMsg) {
}
// Meta-data about the new block this peer is reporting. We use this
// below to update this peer's lastest block height and the heights of
// below to update this peer's latest block height and the heights of
// other peers based on their last announced block hash. This allows us
// to dynamically update the block heights of peers, avoiding stale
// heights when looking for a new sync peer. Upon acceptance of a block
// or recognition of an orphan, we also use this information to update
// the block heights over other peers who's invs may have been ignored
// if we are actively syncing while the chain is not yet current or
// who may have lost the lock announcment race.
// who may have lost the lock announcement race.
var heightUpdate int64
var blkHashUpdate *chainhash.Hash
@ -983,11 +1019,12 @@ func (b *blockManager) handleBlockMsg(bmsg *blockMsg) {
blkHashUpdate = blockHash
orphanRoot := b.chain.GetOrphanRoot(blockHash)
locator, err := b.chain.LatestBlockLocator()
blkLocator, err := b.chain.LatestBlockLocator()
if err != nil {
bmgrLog.Warnf("Failed to get block locator for the "+
"latest block: %v", err)
} else {
locator := chainBlockLocatorToHashes(blkLocator)
err = bmsg.peer.PushGetBlocksMsg(locator, orphanRoot)
if err != nil {
bmgrLog.Warnf("Failed to push getblocksmsg for the "+
@ -1080,7 +1117,7 @@ func (b *blockManager) handleBlockMsg(bmsg *blockMsg) {
prevHash := b.nextCheckpoint.Hash
b.nextCheckpoint = b.findNextHeaderCheckpoint(prevHeight)
if b.nextCheckpoint != nil {
locator := blockchain.BlockLocator([]*chainhash.Hash{prevHash})
locator := []chainhash.Hash{*prevHash}
err := bmsg.peer.PushGetHeadersMsg(locator, b.nextCheckpoint.Hash)
if err != nil {
bmgrLog.Warnf("Failed to send getheaders message to "+
@ -1099,7 +1136,7 @@ func (b *blockManager) handleBlockMsg(bmsg *blockMsg) {
b.headersFirstMode = false
b.headerList.Init()
bmgrLog.Infof("Reached the final checkpoint -- switching to normal mode")
locator := blockchain.BlockLocator([]*chainhash.Hash{blockHash})
locator := []chainhash.Hash{*blockHash}
err = bmsg.peer.PushGetBlocksMsg(locator, &zeroHash)
if err != nil {
bmgrLog.Warnf("Failed to send getblocks message to peer %s: %v",
@ -1248,7 +1285,7 @@ func (b *blockManager) handleHeadersMsg(hmsg *headersMsg) {
// This header is not a checkpoint, so request the next batch of
// headers starting from the latest known header and ending with the
// next checkpoint.
locator := blockchain.BlockLocator([]*chainhash.Hash{finalHash})
locator := []chainhash.Hash{*finalHash}
err := hmsg.peer.PushGetHeadersMsg(locator, b.nextCheckpoint.Hash)
if err != nil {
bmgrLog.Warnf("Failed to send getheaders message to "+
@ -1389,13 +1426,14 @@ func (b *blockManager) handleInvMsg(imsg *invMsg) {
// up to the root of the orphan that just came
// in.
orphanRoot := b.chain.GetOrphanRoot(&iv.Hash)
locator, err := b.chain.LatestBlockLocator()
blkLocator, err := b.chain.LatestBlockLocator()
if err != nil {
bmgrLog.Errorf("PEER: Failed to get block "+
"locator for the latest block: "+
"%v", err)
continue
}
locator := chainBlockLocatorToHashes(blkLocator)
err = imsg.peer.PushGetBlocksMsg(locator, orphanRoot)
if err != nil {
bmgrLog.Errorf("PEER: Failed to push getblocksmsg "+
@ -1412,7 +1450,8 @@ func (b *blockManager) handleInvMsg(imsg *invMsg) {
// Request blocks after this one up to the
// final one the remote peer knows about (zero
// stop hash).
locator := b.chain.BlockLocatorFromHash(&iv.Hash)
blkLocator := b.chain.BlockLocatorFromHash(&iv.Hash)
locator := chainBlockLocatorToHashes(blkLocator)
err = imsg.peer.PushGetBlocksMsg(locator, &zeroHash)
if err != nil {
bmgrLog.Errorf("PEER: Failed to push getblocksmsg: "+

View File

@ -23,8 +23,8 @@ import (
"fmt"
"log"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/chaincfg/v2"
)
var testnet = flag.Bool("testnet", false, "operate on the testnet Decred network")

View File

@ -25,8 +25,8 @@
// "fmt"
// "log"
//
// "github.com/decred/dcrd/dcrutil"
// "github.com/decred/dcrd/chaincfg"
// "github.com/decred/dcrd/dcrutil/v2"
// "github.com/decred/dcrd/chaincfg/v2"
// )
//
// var testnet = flag.Bool("testnet", false, "operate on the testnet Decred network")

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -10,9 +10,9 @@ import (
"path/filepath"
"runtime"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/indexers"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/blockchain/v2/indexers"
"github.com/decred/dcrd/database/v2"
"github.com/decred/dcrd/internal/limits"
"github.com/decred/slog"
)

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -10,10 +10,10 @@ import (
"os"
"path/filepath"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/database"
_ "github.com/decred/dcrd/database/ffldb"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/database/v2"
_ "github.com/decred/dcrd/database/v2/ffldb"
"github.com/decred/dcrd/dcrutil/v2"
flags "github.com/jessevdk/go-flags"
)
@ -27,7 +27,7 @@ var (
dcrdHomeDir = dcrutil.AppDataDir("dcrd", false)
defaultDataDir = filepath.Join(dcrdHomeDir, "data")
knownDbTypes = database.SupportedDrivers()
activeNetParams = &chaincfg.MainNetParams
activeNetParams = chaincfg.MainNetParams()
)
// config defines the configuration options for findcheckpoint.
@ -93,11 +93,11 @@ func loadConfig() (*config, []string, error) {
// while we're at it
if cfg.TestNet {
numNets++
activeNetParams = &chaincfg.TestNet3Params
activeNetParams = chaincfg.TestNet3Params()
}
if cfg.SimNet {
numNets++
activeNetParams = &chaincfg.SimNetParams
activeNetParams = chaincfg.SimNetParams()
}
if numNets > 1 {
str := "%s: the testnet, regtest, and simnet params can't be " +

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -12,11 +12,11 @@ import (
"sync"
"time"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/indexers"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/blockchain/v2/indexers"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/database/v2"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/wire"
)

View File

@ -17,7 +17,7 @@ import (
"strings"
"github.com/decred/dcrd/dcrjson/v3"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/internal/version"
dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types"

View File

@ -15,7 +15,7 @@ import (
"net"
"net/http"
"github.com/decred/dcrd/dcrjson/v2"
"github.com/decred/dcrd/dcrjson/v3"
"github.com/decred/go-socks/socks"
)

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -10,10 +10,10 @@ import (
"os"
"path/filepath"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/database"
_ "github.com/decred/dcrd/database/ffldb"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/database/v2"
_ "github.com/decred/dcrd/database/v2/ffldb"
"github.com/decred/dcrd/dcrutil/v2"
flags "github.com/jessevdk/go-flags"
)
@ -28,7 +28,7 @@ var (
dcrdHomeDir = dcrutil.AppDataDir("dcrd", false)
defaultDataDir = filepath.Join(dcrdHomeDir, "data")
knownDbTypes = database.SupportedDrivers()
activeNetParams = &chaincfg.MainNetParams
activeNetParams = chaincfg.MainNetParams()
)
// config defines the configuration options for findcheckpoint.
@ -80,11 +80,11 @@ func loadConfig() (*config, []string, error) {
// while we're at it
if cfg.TestNet {
numNets++
activeNetParams = &chaincfg.TestNet3Params
activeNetParams = chaincfg.TestNet3Params()
}
if cfg.SimNet {
numNets++
activeNetParams = &chaincfg.SimNetParams
activeNetParams = chaincfg.SimNetParams()
}
if numNets > 1 {
str := "%s: the testnet, regtest, and simnet params can't be " +

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -10,10 +10,10 @@ import (
"os"
"path/filepath"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/database/v2"
)
const blockDbNamePrefix = "blocks"
@ -53,7 +53,7 @@ func findCandidates(chain *blockchain.BlockChain, latestHash *chainhash.Hash) ([
// Set the latest checkpoint to the genesis block if there isn't
// already one.
latestCheckpoint = &chaincfg.Checkpoint{
Hash: activeNetParams.GenesisHash,
Hash: &activeNetParams.GenesisHash,
Height: 0,
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -21,12 +21,12 @@ import (
"strings"
"time"
"github.com/decred/dcrd/connmgr"
"github.com/decred/dcrd/database"
_ "github.com/decred/dcrd/database/ffldb"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/connmgr/v2"
"github.com/decred/dcrd/database/v2"
_ "github.com/decred/dcrd/database/v2/ffldb"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/internal/version"
"github.com/decred/dcrd/mempool/v2"
"github.com/decred/dcrd/mempool/v3"
"github.com/decred/dcrd/rpc/jsonrpc/types"
"github.com/decred/dcrd/sampleconfig"
"github.com/decred/go-socks/socks"
@ -989,7 +989,7 @@ func loadConfig() (*config, []string, error) {
// Check mining addresses are valid and saved parsed versions.
cfg.miningAddrs = make([]dcrutil.Address, 0, len(cfg.MiningAddrs))
for _, strAddr := range cfg.MiningAddrs {
addr, err := dcrutil.DecodeAddress(strAddr)
addr, err := dcrutil.DecodeAddress(strAddr, activeNetParams.Params)
if err != nil {
str := "%s: mining address '%s' failed to decode: %v"
err := fmt.Errorf(str, funcName, strAddr, err)
@ -997,13 +997,6 @@ func loadConfig() (*config, []string, error) {
fmt.Fprintln(os.Stderr, usageMessage)
return nil, nil, err
}
if !addr.IsForNet(activeNetParams.Params) {
str := "%s: mining address '%s' is on the wrong network"
err := fmt.Errorf(str, funcName, strAddr)
fmt.Fprintln(os.Stderr, err)
fmt.Fprintln(os.Stderr, usageMessage)
return nil, nil, err
}
cfg.miningAddrs = append(cfg.miningAddrs, addr)
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2014-2016 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -13,10 +13,11 @@ import (
"sync"
"time"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/wire"
)
@ -49,7 +50,7 @@ var (
// defaultNumWorkers is the default number of workers to use for mining
// and is based on the number of processor cores. This helps ensure the
// system stays reasonably responsive under heavy load.
defaultNumWorkers = uint32(chaincfg.CPUMinerThreads)
defaultNumWorkers = uint32(1)
// littleEndian is a convenience variable since binary.LittleEndian is
// quite long.
@ -240,7 +241,7 @@ func (m *CPUMiner) solveBlock(msgBlock *wire.MsgBlock, ticker *time.Ticker, quit
// Create a couple of convenience variables.
header := &msgBlock.Header
targetDifficulty := blockchain.CompactToBig(header.Bits)
targetDifficulty := standalone.CompactToBig(header.Bits)
// Initial state.
lastGenerated := time.Now()
@ -299,7 +300,7 @@ func (m *CPUMiner) solveBlock(msgBlock *wire.MsgBlock, ticker *time.Ticker, quit
// The block is solved when the new block hash is less
// than the target difficulty. Yay!
if blockchain.HashToBig(&hash).Cmp(targetDifficulty) <= 0 {
if standalone.HashToBig(&hash).Cmp(targetDifficulty) <= 0 {
select {
case m.updateHashes <- hashesCompleted:
default:

View File

@ -24,7 +24,7 @@ func ExampleCreate() {
//
// import (
// "github.com/decred/dcrd/database2"
// _ "github.com/decred/dcrd/database/ffldb"
// _ "github.com/decred/dcrd/database/v2/ffldb"
// )
// Create a database and schedule it to be closed and removed on exit.

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -14,7 +14,7 @@ import (
"runtime/debug"
"runtime/pprof"
"github.com/decred/dcrd/blockchain/indexers"
"github.com/decred/dcrd/blockchain/v2/indexers"
"github.com/decred/dcrd/internal/limits"
"github.com/decred/dcrd/internal/version"
)

View File

@ -2168,8 +2168,8 @@ import (
"log"
"path/filepath"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/rpcclient"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/rpcclient/v4"
)
func main() {
@ -2230,8 +2230,8 @@ import (
"time"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/rpcclient"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/rpcclient/v4"
)
func main() {
@ -2318,8 +2318,8 @@ import (
"path/filepath"
"time"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/rpcclient"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/rpcclient/v4"
)
func main() {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018 The Decred developers
// Copyright (c) 2018-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -11,8 +11,8 @@ import (
"os"
"path"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/fees"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/fees/v2"
flags "github.com/jessevdk/go-flags"
)

View File

@ -15,9 +15,9 @@ import (
"github.com/btcsuite/goleveldb/leveldb"
ldbutil "github.com/btcsuite/goleveldb/leveldb/util"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/dcrutil/v2"
)
const (

View File

@ -1,12 +1,13 @@
module github.com/decred/dcrd/fees
module github.com/decred/dcrd/fees/v2
go 1.11
require (
github.com/btcsuite/goleveldb v1.0.0
github.com/decred/dcrd/blockchain/stake v1.1.0
github.com/decred/dcrd/chaincfg/chainhash v1.0.1
github.com/decred/dcrd/dcrutil v1.2.0
github.com/dchest/blake256 v1.1.0 // indirect
github.com/decred/dcrd/blockchain/stake/v2 v2.0.1
github.com/decred/dcrd/chaincfg/chainhash v1.0.2
github.com/decred/dcrd/dcrutil/v2 v2.0.0
github.com/decred/slog v1.0.0
github.com/jessevdk/go-flags v1.4.0
)

View File

@ -10,102 +10,71 @@ 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/dchest/blake256 v1.0.0 h1:6gUgI5MHdz9g0TdrgKqXsoDX+Zjxmm1Sc6OsoGru50I=
github.com/dchest/blake256 v1.0.0/go.mod h1:xXNWCE1jsAP8DAjP+rKw2MbeqLczjI3TRx2VK+9OEYY=
github.com/dchest/blake256 v1.1.0 h1:4AuEhGPT/3TTKFhTfBpZ8hgZE7wJpawcYaEawwsbtqM=
github.com/dchest/blake256 v1.1.0/go.mod h1:xXNWCE1jsAP8DAjP+rKw2MbeqLczjI3TRx2VK+9OEYY=
github.com/decred/base58 v1.0.0 h1:BVi1FQCThIjZ0ehG+I99NJ51o0xcc9A/fDKhmJxY6+w=
github.com/decred/base58 v1.0.0/go.mod h1:LLY1p5e3g91byL/UO1eiZaYd+uRoVRarybgcoymu9Ks=
github.com/decred/dcrd/blockchain/stake v1.1.0 h1:kCxZdQ2/UfcD+XjE3wlCv0vLKWR9ZFtjbbTTpudb74o=
github.com/decred/dcrd/blockchain/stake v1.1.0/go.mod h1:WRuaml4bcyZYza1NT3qizlLcQwMIcAQRENvZVb2t884=
github.com/decred/dcrd/chaincfg v1.1.1/go.mod h1:UlGtnp8Xx9YK+etBTybGjoFGoGXSw2bxZQuAnwfKv6I=
github.com/decred/dcrd/chaincfg v1.2.0 h1:Vj0xr85wmqOdQDxKLkpP9TqwK1RykqY2eC0fWcCsl0k=
github.com/decred/dcrd/chaincfg v1.2.0/go.mod h1:kpoGTMIriKn5hHRSu5b65+Q9LlGUdbQcMzGujac1BVs=
github.com/decred/dcrd/blockchain/stake/v2 v2.0.1 h1:mAPZZA+Or8NPENheejmD6Fl90uykhurVuEdOBUMl35s=
github.com/decred/dcrd/blockchain/stake/v2 v2.0.1/go.mod h1:jv/rKMcZ87lhvVkHot/tElxeAYEUJ3mnKPHJ7WPq86U=
github.com/decred/dcrd/chaincfg/chainhash v1.0.1 h1:0vG7U9+dSjSCaHQKdoSKURK2pOb47+b+8FK5q4+Je7M=
github.com/decred/dcrd/chaincfg/chainhash v1.0.1/go.mod h1:OVfvaOsNLS/A1y4Eod0Ip/Lf8qga7VXCQjUQLbkY0Go=
github.com/decred/dcrd/database v1.0.1 h1:BSIerNf4RhSA0iDhiE/320RYqD2y9T+SCj99Pv7svgo=
github.com/decred/dcrd/database v1.0.1/go.mod h1:ILCeyOHFew3fZ7K2B9jl+tp5qFOap/pEGoo6Yy6Wk0g=
github.com/decred/dcrd/database v1.0.3 h1:e5Q3gDt9LwfvpZxYqFF3OVzgr8bGeC1cen+V3mv/CCw=
github.com/decred/dcrd/database v1.0.3/go.mod h1:TLxRwIV8x85+dxPTLAWu4mHg45TkKrrza5xzwOS1QtA=
github.com/decred/dcrd/dcrec v0.0.0-20180721005212-59fe2b293f69 h1:0JYiZpiXU60VHfyq22xJUJR/IpTzjrasWWK1b6Fw76c=
github.com/decred/dcrd/dcrec v0.0.0-20180721005212-59fe2b293f69/go.mod h1:cRAH1SNk8Mi9hKBc/DHbeiWz/fyO8KWZR3H7okrIuOA=
github.com/decred/dcrd/dcrec v0.0.0-20180721031028-5369a485acf6/go.mod h1:cRAH1SNk8Mi9hKBc/DHbeiWz/fyO8KWZR3H7okrIuOA=
github.com/decred/dcrd/dcrec v0.0.0-20180801202239-0761de129164 h1:N5s3yVfjBNW6XNG3gLxYpvt0IUjUsp/FRfC75QpSI+E=
github.com/decred/dcrd/dcrec v0.0.0-20180801202239-0761de129164/go.mod h1:cRAH1SNk8Mi9hKBc/DHbeiWz/fyO8KWZR3H7okrIuOA=
github.com/decred/dcrd/dcrec v0.0.0-20190130161649-59ed4247a1d5 h1:rz0HmQLuABmKj2fFaeYMpJSG66JrDhU3mQ1tDBeGfQk=
github.com/decred/dcrd/dcrec v0.0.0-20190130161649-59ed4247a1d5/go.mod h1:cRAH1SNk8Mi9hKBc/DHbeiWz/fyO8KWZR3H7okrIuOA=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20180721005212-59fe2b293f69/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20180721031028-5369a485acf6/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20181208004914-a0816cf4301f h1:NF7vp3nZ4MsAiXswGmE//m83jCN0lDsQrLI7IwLCTlo=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20181208004914-a0816cf4301f/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20190130161649-59ed4247a1d5 h1:qA+q5URxOMLCts1hTsNlXfOOtT2d83b3Z597yupIn5A=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20190130161649-59ed4247a1d5/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.0 h1:Le54WTGdTQv7XYXpS31uhFE8LZE7ypwsIL+FgDP2x5Q=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.0/go.mod h1:JPMFscGlgXTV684jxQNDijae2qrh0fLG7pJBimaYotE=
github.com/decred/dcrd/chaincfg/chainhash v1.0.2 h1:rt5Vlq/jM3ZawwiacWjPa+smINyLRN07EO0cNBV6DGU=
github.com/decred/dcrd/chaincfg/chainhash v1.0.2/go.mod h1:BpbrGgrPTr3YJYRN3Bm+D9NuaFd+zGyNeIKgrhCXK60=
github.com/decred/dcrd/chaincfg/v2 v2.0.2 h1:VeGY52lHuYT01tIGbvYj+OO0GaGxGaJmnh+4vGca1+U=
github.com/decred/dcrd/chaincfg/v2 v2.0.2/go.mod h1:hpKvhLCDAD/xDZ3V1Pqpv9fIKVYYi11DyxETguazyvg=
github.com/decred/dcrd/chaincfg/v2 v2.1.0 h1:2S7TL9YWnKDDiH5bTpp3xcBo+1gl1IXFi5KU4QwSIDk=
github.com/decred/dcrd/chaincfg/v2 v2.1.0/go.mod h1:hpKvhLCDAD/xDZ3V1Pqpv9fIKVYYi11DyxETguazyvg=
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/database/v2 v2.0.0 h1:KWiyZHk+QyNKQvvxm/KpIejhTqYJqH9ssz1+9sT9nVA=
github.com/decred/dcrd/database/v2 v2.0.0/go.mod h1:Sj2lvTRB0mfSu9uD7ObfwCY/eJ954GFU/X+AndJIyfE=
github.com/decred/dcrd/dcrec v1.0.0 h1:W+z6Es+Rai3MXYVoPAxYr5U1DGis0Co33scJ6uH2J6o=
github.com/decred/dcrd/dcrec v1.0.0/go.mod h1:HIaqbEJQ+PDzQcORxnqen5/V1FR3B4VpIfmePklt8Q8=
github.com/decred/dcrd/dcrec/edwards v1.0.0 h1:UDcPNzclKiJlWqV3x1Fl8xMCJrolo4PB4X9t8LwKDWU=
github.com/decred/dcrd/dcrec/edwards v1.0.0/go.mod h1:HblVh1OfMt7xSxUL1ufjToaEvpbjpWvvTAUx4yem8BI=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.1 h1:EFWVd1p0t0Y5tnsm/dJujgV0ORogRJ6vo7CMAjLseAc=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.1/go.mod h1:lhu4eZFSfTJWUnR3CFRcpD+Vta0KUAqnhTsTksHXgy0=
github.com/decred/dcrd/dcrutil v1.1.1/go.mod h1:Jsttr0pEvzPAw+qay1kS1/PsbZYPyhluiNwwY6yBJS4=
github.com/decred/dcrd/dcrutil v1.2.0 h1:Pd5Wf650g6Xu6luYDfGkh1yiUoPUAgqzRu6K+BGyJGg=
github.com/decred/dcrd/dcrutil v1.2.0/go.mod h1:tUNHS2gj7ApeEVS8gb6O+4wJW7w3O2MSRyRdcjW1JxU=
github.com/decred/dcrd/txscript v1.0.1 h1:IMgxZFCw3AyG4EbKwywE3SDNshOSHsoUK1Wk/5GqWJ0=
github.com/decred/dcrd/txscript v1.0.1/go.mod h1:FqUX07Y+u3cJ1eIGPoyWbJg+Wk1NTllln/TyDpx9KnY=
github.com/decred/dcrd/txscript v1.0.2 h1:kzJZDuteyzvI15VNhtgFHxeeq210RTkFyfzN7d+1iPo=
github.com/decred/dcrd/txscript v1.0.2/go.mod h1:hmUOHFlOjU7H6T/czt6kurWwXJvGPGKKGtXoft6w/qY=
github.com/decred/dcrd/wire v1.1.0/go.mod h1:/JKOsLInOJu6InN+/zH5AyCq3YDIOW/EqcffvU8fJHM=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.2 h1:awk7sYJ4pGWmtkiGHFfctztJjHMKGLV8jctGQhAbKe0=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.2/go.mod h1:CHTUIVfmDDd0KFVFpNX1pFVCBUegxW387nN0IGwNKR0=
github.com/decred/dcrd/dcrutil/v2 v2.0.0 h1:HTqn2tZ8eqBF4y3hJwjyKBmJt16y7/HjzpE82E/crhY=
github.com/decred/dcrd/dcrutil/v2 v2.0.0/go.mod h1:gUshVAXpd51DlcEhr51QfWL2HJGkMDM1U8chY+9VvQg=
github.com/decred/dcrd/txscript/v2 v2.0.0 h1:So+NcQY58mDHDN2N2edED5syGZp2ed8Ltxj8mDE5CAs=
github.com/decred/dcrd/txscript/v2 v2.0.0/go.mod h1:WStcyYYJa+PHJB4XjrLDRzV96/Z4thtsu8mZoVrU6C0=
github.com/decred/dcrd/wire v1.2.0 h1:HqJVB7vcklIguzFWgRXw/WYCQ9cD3bUC5TKj53i1Hng=
github.com/decred/dcrd/wire v1.2.0/go.mod h1:/JKOsLInOJu6InN+/zH5AyCq3YDIOW/EqcffvU8fJHM=
github.com/decred/slog v1.0.0 h1:Dl+W8O6/JH6n2xIFN2p3DNjCmjYwvrXsjlSJTQQ4MhE=
github.com/decred/slog v1.0.0/go.mod h1:zR98rEZHSnbZ4WHZtO0iqmSZjDLKhkXfrPTZQKtAonQ=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
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/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.1 h1:PZSj/UFNaVp3KxrzHOcS7oyuWA7LoOY/77yCTEFu21U=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
golang.org/x/crypto v0.0.0-20180718160520-a2144134853f h1:lRy+hhwk7YT7MsKejxuz0C5Q1gk6p/QoPQYEmKmGFb8=
golang.org/x/crypto v0.0.0-20180718160520-a2144134853f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613 h1:MQ/ZZiDsUapFFiMS+vzwXkCTeEKaum+Do5rINYJDmxc=
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d h1:i6RB+Qz1ug7TvJdY4zieRMpnLAtkHSHTOvApNXfLT4A=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180808004115-f9ce57c11b24 h1:mEsFm194MmS9vCwxFy+zwu0EU7ZkxxMD1iH++vmGdUY=
golang.org/x/net v0.0.0-20180808004115-f9ce57c11b24/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 h1:ulvT7fqt0yHWzpJwI57MezWnYDVpCAYBVuYst/L+fAY=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190203050204-7ae0202eb74c h1:YeMXU0KQqExdpG959DFhAhfpY8myIsnfqj8lhNFRzzE=
golang.org/x/sys v0.0.0-20190203050204-7ae0202eb74c/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 h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
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/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
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.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

27
go.mod
View File

@ -6,39 +6,27 @@ require (
github.com/btcsuite/winsvc v1.0.0
github.com/decred/base58 v1.0.0
github.com/decred/dcrd/addrmgr v1.0.2
github.com/decred/dcrd/blockchain v1.2.0
github.com/decred/dcrd/blockchain/stake v1.2.1
github.com/decred/dcrd/blockchain/stake/v2 v2.0.1
github.com/decred/dcrd/blockchain/standalone v1.0.0
github.com/decred/dcrd/blockchain/v2 v2.0.2
github.com/decred/dcrd/certgen v1.1.0
github.com/decred/dcrd/chaincfg v1.5.2
github.com/decred/dcrd/chaincfg/chainhash v1.0.2
github.com/decred/dcrd/chaincfg/v2 v2.2.0
github.com/decred/dcrd/connmgr v1.1.0
github.com/decred/dcrd/connmgr/v2 v2.0.0-00010101000000-000000000000
github.com/decred/dcrd/crypto/blake256 v1.0.0
github.com/decred/dcrd/database v1.1.0
github.com/decred/dcrd/connmgr/v2 v2.0.0
github.com/decred/dcrd/database/v2 v2.0.0
github.com/decred/dcrd/dcrec v1.0.0
github.com/decred/dcrd/dcrec/secp256k1 v1.0.2
github.com/decred/dcrd/dcrjson/v2 v2.2.0
github.com/decred/dcrd/dcrjson/v3 v3.0.0
github.com/decred/dcrd/dcrutil v1.4.0
github.com/decred/dcrd/dcrutil/v2 v2.0.0
github.com/decred/dcrd/fees v1.0.0
github.com/decred/dcrd/fees/v2 v2.0.0
github.com/decred/dcrd/gcs v1.1.0
github.com/decred/dcrd/hdkeychain/v2 v2.0.1
github.com/decred/dcrd/lru v1.0.0
github.com/decred/dcrd/mempool/v2 v2.1.0
github.com/decred/dcrd/mempool/v3 v3.0.0
github.com/decred/dcrd/mining v1.1.1
github.com/decred/dcrd/mining/v2 v2.0.0
github.com/decred/dcrd/peer v1.2.0
github.com/decred/dcrd/peer/v2 v2.0.0
github.com/decred/dcrd/rpc/jsonrpc/types v1.0.0
github.com/decred/dcrd/rpcclient/v3 v3.0.0
github.com/decred/dcrd/txscript v1.1.0
github.com/decred/dcrd/rpcclient/v4 v4.0.0
github.com/decred/dcrd/txscript/v2 v2.0.0
github.com/decred/dcrd/wire v1.2.0
github.com/decred/dcrwallet/rpc/jsonrpc/types v1.2.0
@ -48,10 +36,11 @@ require (
github.com/jessevdk/go-flags v1.4.0
github.com/jrick/bitset v1.0.0
github.com/jrick/logrotate v1.0.0
github.com/kr/pretty v0.1.0 // indirect
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
)
replace (
@ -67,7 +56,7 @@ replace (
github.com/decred/dcrd/dcrec => ./dcrec
github.com/decred/dcrd/dcrjson/v3 => ./dcrjson
github.com/decred/dcrd/dcrutil/v2 => ./dcrutil
github.com/decred/dcrd/fees => ./fees
github.com/decred/dcrd/fees/v2 => ./fees
github.com/decred/dcrd/gcs => ./gcs
github.com/decred/dcrd/hdkeychain/v2 => ./hdkeychain
github.com/decred/dcrd/limits => ./limits

56
go.sum
View File

@ -15,54 +15,17 @@ github.com/dchest/siphash v1.2.1 h1:4cLinnzVJDKxTCl9B01807Yiy+W7ZzVHj/KIroQRvT4=
github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
github.com/decred/base58 v1.0.0 h1:BVi1FQCThIjZ0ehG+I99NJ51o0xcc9A/fDKhmJxY6+w=
github.com/decred/base58 v1.0.0/go.mod h1:LLY1p5e3g91byL/UO1eiZaYd+uRoVRarybgcoymu9Ks=
github.com/decred/dcrd/blockchain v1.2.0 h1:XiNd8lsU3marW7Z9xwctaXYm/7xakWOla/ZYJIPIG9w=
github.com/decred/dcrd/blockchain v1.2.0/go.mod h1:U/cia18M3LOJjk30jYRIEJivI6wh8v+53+gANC2npA4=
github.com/decred/dcrd/blockchain/stake v1.1.0/go.mod h1:WRuaml4bcyZYza1NT3qizlLcQwMIcAQRENvZVb2t884=
github.com/decred/dcrd/blockchain/stake v1.2.1 h1:Llj+mKNJEnMskeakMj62hllNVtiHF2vo7cDxsvoLVFg=
github.com/decred/dcrd/blockchain/stake v1.2.1/go.mod h1:3YGhsM2WCwUM6o0WLGoTCUXLOOw6H7tqXtVtWlcCE/Y=
github.com/decred/dcrd/blockchain/stake/v2 v2.0.0 h1:+FMrSt5tPicBKlev0k/r/2VsaVwpIUcm1TPw69XgZw0=
github.com/decred/dcrd/blockchain/stake/v2 v2.0.0/go.mod h1:jv/rKMcZ87lhvVkHot/tElxeAYEUJ3mnKPHJ7WPq86U=
github.com/decred/dcrd/blockchain/stake/v2 v2.0.1 h1:mAPZZA+Or8NPENheejmD6Fl90uykhurVuEdOBUMl35s=
github.com/decred/dcrd/blockchain/stake/v2 v2.0.1/go.mod h1:jv/rKMcZ87lhvVkHot/tElxeAYEUJ3mnKPHJ7WPq86U=
github.com/decred/dcrd/chaincfg v1.1.1/go.mod h1:UlGtnp8Xx9YK+etBTybGjoFGoGXSw2bxZQuAnwfKv6I=
github.com/decred/dcrd/chaincfg v1.2.0/go.mod h1:kpoGTMIriKn5hHRSu5b65+Q9LlGUdbQcMzGujac1BVs=
github.com/decred/dcrd/chaincfg v1.5.1 h1:u1Xbq0VTnAXIHW5ECqrWe0VYSgf5vWHqpSiwoLBzxAQ=
github.com/decred/dcrd/chaincfg v1.5.1/go.mod h1:FukMzTjkwzjPU+hK7CqDMQe3NMbSZAYU5PAcsx1wlv0=
github.com/decred/dcrd/chaincfg v1.5.2 h1:dd6l9rqcpxg2GF5neBmE2XxRc5Lqda45fWmN4XOJRW8=
github.com/decred/dcrd/chaincfg v1.5.2/go.mod h1:FukMzTjkwzjPU+hK7CqDMQe3NMbSZAYU5PAcsx1wlv0=
github.com/decred/dcrd/connmgr v1.1.0 h1:JtKI3XjHOlJktaoZupxz8FKEKj/dqGFYJOF+vD/4ydQ=
github.com/decred/dcrd/connmgr v1.1.0/go.mod h1:LepSJ1qu+cnY6nmUdiVUsX/NTFcd73FNEegrY7wuEpU=
github.com/decred/dcrd/database v1.0.1/go.mod h1:ILCeyOHFew3fZ7K2B9jl+tp5qFOap/pEGoo6Yy6Wk0g=
github.com/decred/dcrd/database v1.1.0 h1:A9doThqEjOiE8NicDbMmRwr74itM47rcOzzWpy+keYU=
github.com/decred/dcrd/database v1.1.0/go.mod h1:/c8suHgDP20weTDFpObwvNbrMMlxn2LM4Tvm377ztwQ=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20180721005212-59fe2b293f69/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20180721031028-5369a485acf6/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v0.0.0-20181208004914-a0816cf4301f/go.mod h1:+ehP0Hk/mesyZXttxCtBbhPX23BMpZJ1pcVBqUfbmvU=
github.com/decred/dcrd/dcrec/edwards v1.0.0 h1:UDcPNzclKiJlWqV3x1Fl8xMCJrolo4PB4X9t8LwKDWU=
github.com/decred/dcrd/dcrec/edwards v1.0.0/go.mod h1:HblVh1OfMt7xSxUL1ufjToaEvpbjpWvvTAUx4yem8BI=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.0/go.mod h1:JPMFscGlgXTV684jxQNDijae2qrh0fLG7pJBimaYotE=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.1/go.mod h1:lhu4eZFSfTJWUnR3CFRcpD+Vta0KUAqnhTsTksHXgy0=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.2 h1:awk7sYJ4pGWmtkiGHFfctztJjHMKGLV8jctGQhAbKe0=
github.com/decred/dcrd/dcrec/secp256k1 v1.0.2/go.mod h1:CHTUIVfmDDd0KFVFpNX1pFVCBUegxW387nN0IGwNKR0=
github.com/decred/dcrd/dcrjson/v2 v2.2.0 h1:u0ON3IZ8/fqoA624HPNBsWYjIgBtC82DGMtq35bthhI=
github.com/decred/dcrd/dcrjson/v2 v2.2.0/go.mod h1:/vbjikqJR0MVih59iOMtPjRyN5lVRDzJHHfqzHAln2Y=
github.com/decred/dcrd/dcrutil v1.1.1/go.mod h1:Jsttr0pEvzPAw+qay1kS1/PsbZYPyhluiNwwY6yBJS4=
github.com/decred/dcrd/dcrutil v1.2.0/go.mod h1:tUNHS2gj7ApeEVS8gb6O+4wJW7w3O2MSRyRdcjW1JxU=
github.com/decred/dcrd/dcrutil v1.3.0 h1:LtKIiDnq925yJT/4OpIKKiU9/WaxfD9LfhxrpLSi0Qs=
github.com/decred/dcrd/dcrutil v1.3.0/go.mod h1:7fUT70QAarhDwQK62g92uDbbYpjXlXngpy5RBiecufo=
github.com/decred/dcrd/dcrutil v1.4.0 h1:xD5aUqysGQnsnP1c9J0kGeW8lDIwFGC3ja/gE3HnpCs=
github.com/decred/dcrd/dcrutil v1.4.0/go.mod h1:Bs74gm1jQ9ZAbmEh9FWOEZ1HQzlMg5iPATDMzMnCMlQ=
github.com/decred/dcrd/mempool/v2 v2.1.0 h1:6paXM3cqt5mFfm60SwjVmUyC4DzIXL4lTMrRbLLnBZw=
github.com/decred/dcrd/mempool/v2 v2.1.0/go.mod h1:Quaiv/b1iNV//SPELqW9VdN+Ht07Kc3SdGCvYlwfyuk=
github.com/decred/dcrd/mining v1.1.1 h1:kZvXfq6rE7HQUJqtbS9TmZM+B2Gs0DuzBvNzaw9meGI=
github.com/decred/dcrd/mining v1.1.1/go.mod h1:0/vByjMDaXR3VRCoONgzqORV0mplgQ2mDWyiVXroc6Q=
github.com/decred/dcrd/peer v1.2.0 h1:PGAeufm/GAa7wscnDGWEwAtkjjo3giZ1E887eb6j3XA=
github.com/decred/dcrd/peer v1.2.0/go.mod h1:zuojGD0m0s1KG5dwaS402Y+8oZA0S+0C1XNg5EpMPwc=
github.com/decred/dcrd/rpcclient/v3 v3.0.0 h1:doabWkWWd8O6ccYqaLamE1mkQ5p8YoO5UJhkl5pAGpQ=
github.com/decred/dcrd/rpcclient/v3 v3.0.0/go.mod h1:OQ361/iQMrJtWIg+S0XpZT4/AA6mU/46oOkBRWp/P/s=
github.com/decred/dcrd/txscript v1.0.1/go.mod h1:FqUX07Y+u3cJ1eIGPoyWbJg+Wk1NTllln/TyDpx9KnY=
github.com/decred/dcrd/txscript v1.1.0 h1:MwkLXdc4Yq83oeNNEQJdlBTkNlorKXn8Nd5W2JXyMZg=
github.com/decred/dcrd/txscript v1.1.0/go.mod h1:gbcq6gpGfKddPmZSKp+17ils2cLzUqHopXf8H5rCY7Y=
github.com/decred/dcrd/rpcclient/v4 v4.0.0 h1:8C3lNs2mvfu9CDjFzz1BOiDDbWBG9aTH82PCiGMP3FE=
github.com/decred/dcrd/rpcclient/v4 v4.0.0/go.mod h1:DNGwfiL5H+K/pk3hVB0z5ypRdiDXMssR+YEqDUEXCQo=
github.com/decred/dcrwallet/rpc/jsonrpc/types v1.1.0 h1:ZOMpbSK/Cz8D8Yfrt7/yNfS+myBUWMNOdgAg31ND7bM=
github.com/decred/dcrwallet/rpc/jsonrpc/types v1.1.0/go.mod h1:xUT7XXATLOzE0pwwmvgfRWtZdrB+PsWFilo+jkH5/Ig=
github.com/decred/dcrwallet/rpc/jsonrpc/types v1.2.0 h1:k17F1rYmYRqX3iO8nQBrSacbB8A50qNU+HT3gfNo4dw=
@ -73,7 +36,6 @@ github.com/decred/slog v1.0.0 h1:Dl+W8O6/JH6n2xIFN2p3DNjCmjYwvrXsjlSJTQQ4MhE=
github.com/decred/slog v1.0.0/go.mod h1:zR98rEZHSnbZ4WHZtO0iqmSZjDLKhkXfrPTZQKtAonQ=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
@ -86,11 +48,6 @@ github.com/jrick/bitset v1.0.0 h1:Ws0PXV3PwXqWK2n7Vz6idCdrV/9OrBXgHEJi27ZB9Dw=
github.com/jrick/bitset v1.0.0/go.mod h1:ZOYB5Uvkla7wIEY4FEssPVi3IQXa02arznRaYaAEPe4=
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/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
@ -99,20 +56,17 @@ github.com/onsi/gomega v1.4.1 h1:PZSj/UFNaVp3KxrzHOcS7oyuWA7LoOY/77yCTEFu21U=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
golang.org/x/crypto v0.0.0-20180718160520-a2144134853f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180808004115-f9ce57c11b24/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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 h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
@ -121,8 +75,6 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
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/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=

20
log.go
View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2017 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -11,15 +11,15 @@ import (
"path/filepath"
"github.com/decred/dcrd/addrmgr"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/indexers"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/connmgr"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/fees"
"github.com/decred/dcrd/mempool/v2"
"github.com/decred/dcrd/peer"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/blockchain/v2/indexers"
"github.com/decred/dcrd/connmgr/v2"
"github.com/decred/dcrd/database/v2"
"github.com/decred/dcrd/fees/v2"
"github.com/decred/dcrd/mempool/v3"
"github.com/decred/dcrd/peer/v2"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/slog"
"github.com/jrick/logrotate/rotator"
)

101
mining.go
View File

@ -16,13 +16,14 @@ import (
"sync"
"time"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/mining"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/mining/v2"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
)
@ -501,8 +502,7 @@ func UpdateExtraNonce(msgBlock *wire.MsgBlock, blockHeight int64, extraNonce uin
// Recalculate the merkle root with the updated extra nonce.
block := dcrutil.NewBlockDeepCopyCoinbase(msgBlock)
merkles := blockchain.BuildMerkleTreeStore(block.Transactions())
msgBlock.Header.MerkleRoot = *merkles[len(merkles)-1]
msgBlock.Header.MerkleRoot = calcTxTreeMerkleRoot(block.Transactions())
return nil
}
@ -512,7 +512,7 @@ func UpdateExtraNonce(msgBlock *wire.MsgBlock, blockHeight int64, extraNonce uin
//
// See the comment for NewBlockTemplate for more information about why the nil
// address handling is useful.
func createCoinbaseTx(subsidyCache *blockchain.SubsidyCache, coinbaseScript []byte, opReturnPkScript []byte, nextBlockHeight int64, addr dcrutil.Address, voters uint16, params *chaincfg.Params) (*dcrutil.Tx, error) {
func createCoinbaseTx(subsidyCache *standalone.SubsidyCache, coinbaseScript []byte, opReturnPkScript []byte, nextBlockHeight int64, addr dcrutil.Address, voters uint16, params *chaincfg.Params) (*dcrutil.Tx, error) {
tx := wire.NewMsgTx()
tx.AddTxIn(&wire.TxIn{
// Coinbase transactions have no inputs, so previous outpoint is
@ -527,25 +527,11 @@ func createCoinbaseTx(subsidyCache *blockchain.SubsidyCache, coinbaseScript []by
// Block one is a special block that might pay out tokens to a ledger.
if nextBlockHeight == 1 && len(params.BlockOneLedger) != 0 {
// Convert the addresses in the ledger into useable format.
addrs := make([]dcrutil.Address, len(params.BlockOneLedger))
for i, payout := range params.BlockOneLedger {
addr, err := dcrutil.DecodeAddress(payout.Address)
if err != nil {
return nil, err
}
addrs[i] = addr
}
for i, payout := range params.BlockOneLedger {
// Make payout to this address.
pks, err := txscript.PayToAddrScript(addrs[i])
if err != nil {
return nil, err
}
for _, payout := range params.BlockOneLedger {
tx.AddTxOut(&wire.TxOut{
Value: payout.Amount,
PkScript: pks,
Version: payout.ScriptVersion,
PkScript: payout.Script,
})
}
@ -555,30 +541,24 @@ func createCoinbaseTx(subsidyCache *blockchain.SubsidyCache, coinbaseScript []by
}
// Create a coinbase with correct block subsidy and extranonce.
subsidy := blockchain.CalcBlockWorkSubsidy(subsidyCache,
nextBlockHeight,
voters,
activeNetParams.Params)
tax := blockchain.CalcBlockTaxSubsidy(subsidyCache,
nextBlockHeight,
voters,
activeNetParams.Params)
workSubsidy := subsidyCache.CalcWorkSubsidy(nextBlockHeight, voters)
treasurySubsidy := subsidyCache.CalcTreasurySubsidy(nextBlockHeight, voters)
// Tax output.
// Treasury output.
if params.BlockTaxProportion > 0 {
tx.AddTxOut(&wire.TxOut{
Value: tax,
Value: treasurySubsidy,
PkScript: params.OrganizationPkScript,
})
} else {
// Tax disabled.
// Treasury disabled.
scriptBuilder := txscript.NewScriptBuilder()
trueScript, err := scriptBuilder.AddOp(txscript.OP_TRUE).Script()
if err != nil {
return nil, err
}
tx.AddTxOut(&wire.TxOut{
Value: tax,
Value: treasurySubsidy,
PkScript: trueScript,
})
}
@ -588,7 +568,7 @@ func createCoinbaseTx(subsidyCache *blockchain.SubsidyCache, coinbaseScript []by
PkScript: opReturnPkScript,
})
// ValueIn.
tx.TxIn[0].ValueIn = subsidy + tax
tx.TxIn[0].ValueIn = workSubsidy + treasurySubsidy
// Create the script to pay to the provided payment address if one was
// specified. Otherwise create a script that allows the coinbase to be
@ -610,7 +590,7 @@ func createCoinbaseTx(subsidyCache *blockchain.SubsidyCache, coinbaseScript []by
}
// Subsidy paid to miner.
tx.AddTxOut(&wire.TxOut{
Value: subsidy,
Value: workSubsidy,
PkScript: pksSubsidy,
})
@ -775,7 +755,7 @@ func deepCopyBlockTemplate(blockTemplate *BlockTemplate) *BlockTemplate {
// work off of is present, it will return a copy of that template to pass to the
// miner.
// Safe for concurrent access.
func handleTooFewVoters(subsidyCache *blockchain.SubsidyCache, nextHeight int64, miningAddress dcrutil.Address, bm *blockManager) (*BlockTemplate, error) {
func handleTooFewVoters(subsidyCache *standalone.SubsidyCache, nextHeight int64, miningAddress dcrutil.Address, bm *blockManager) (*BlockTemplate, error) {
timeSource := bm.cfg.TimeSource
stakeValidationHeight := bm.cfg.ChainParams.StakeValidationHeight
curTemplate := bm.GetCurrentTemplate()
@ -924,12 +904,9 @@ func handleTooFewVoters(subsidyCache *blockchain.SubsidyCache, nextHeight int64,
// Recalculate the merkle roots. Use a temporary 'immutable'
// block object as we're changing the header contents.
btBlockTemp := dcrutil.NewBlockDeepCopyCoinbase(btMsgBlock)
merkles :=
blockchain.BuildMerkleTreeStore(btBlockTemp.Transactions())
merklesStake :=
blockchain.BuildMerkleTreeStore(btBlockTemp.STransactions())
btMsgBlock.Header.MerkleRoot = *merkles[len(merkles)-1]
btMsgBlock.Header.StakeRoot = *merklesStake[len(merklesStake)-1]
header := &btMsgBlock.Header
header.MerkleRoot = calcTxTreeMerkleRoot(btBlockTemp.Transactions())
header.StakeRoot = calcTxTreeMerkleRoot(btBlockTemp.STransactions())
// Make sure the block validates.
btBlock := dcrutil.NewBlockDeepCopyCoinbase(btMsgBlock)
@ -966,6 +943,7 @@ type BlkTmplGenerator struct {
policy *mining.Policy
txSource mining.TxSource
sigCache *txscript.SigCache
subsidyCache *standalone.SubsidyCache
chainParams *chaincfg.Params
chain *blockchain.BlockChain
blockManager *blockManager
@ -976,12 +954,15 @@ type BlkTmplGenerator struct {
// policy using transactions from the provided transaction source.
func newBlkTmplGenerator(policy *mining.Policy, txSource mining.TxSource,
timeSource blockchain.MedianTimeSource, sigCache *txscript.SigCache,
chainParams *chaincfg.Params, chain *blockchain.BlockChain,
subsidyCache *standalone.SubsidyCache, chainParams *chaincfg.Params,
chain *blockchain.BlockChain,
blockManager *blockManager) *BlkTmplGenerator {
return &BlkTmplGenerator{
policy: policy,
txSource: txSource,
sigCache: sigCache,
subsidyCache: subsidyCache,
chainParams: chainParams,
chain: chain,
blockManager: blockManager,
@ -1071,8 +1052,6 @@ func newBlkTmplGenerator(policy *mining.Policy, txSource mining.TxSource,
// This function returns nil, nil if there are not enough voters on any of
// the current top blocks to create a new block template.
func (g *BlkTmplGenerator) NewBlockTemplate(payToAddress dcrutil.Address) (*BlockTemplate, error) {
subsidyCache := g.chain.FetchSubsidyCache()
// All transaction scripts are verified using the more strict standarad
// flags.
scriptFlags, err := standardScriptVerifyFlags(g.chain)
@ -1122,7 +1101,7 @@ func (g *BlkTmplGenerator) NewBlockTemplate(payToAddress dcrutil.Address) (*Bloc
if len(eligibleParents) == 0 {
minrLog.Debugf("Too few voters found on any HEAD block, " +
"recycling a parent block to mine on")
return handleTooFewVoters(subsidyCache, nextBlockHeight,
return handleTooFewVoters(g.subsidyCache, nextBlockHeight,
payToAddress, g.blockManager)
}
@ -1209,7 +1188,7 @@ mempoolLoop:
// non-finalized transactions.
tx := txDesc.Tx
msgTx := tx.MsgTx()
if blockchain.IsCoinBaseTx(msgTx) {
if standalone.IsCoinBaseTx(msgTx) {
minrLog.Tracef("Skipping coinbase tx %s", tx.Hash())
continue
}
@ -1495,7 +1474,7 @@ mempoolLoop:
// preconditions before allowing it to be added to the block.
// The fraud proof is not checked because it will be filled in
// by the miner.
_, err = blockchain.CheckTransactionInputs(subsidyCache, tx,
_, err = blockchain.CheckTransactionInputs(g.subsidyCache, tx,
nextBlockHeight, blockUtxos, false, g.chainParams)
if err != nil {
minrLog.Tracef("Skipping tx %s due to error in "+
@ -1742,7 +1721,7 @@ mempoolLoop:
if err != nil {
return nil, err
}
coinbaseTx, err := createCoinbaseTx(subsidyCache,
coinbaseTx, err := createCoinbaseTx(g.subsidyCache,
coinbaseScript,
opReturnPkScript,
nextBlockHeight,
@ -1849,7 +1828,7 @@ mempoolLoop:
voters < minimumVotesRequired {
minrLog.Warnf("incongruent number of voters in mempool " +
"vs mempool.voters; not enough voters found")
return handleTooFewVoters(subsidyCache, nextBlockHeight, payToAddress,
return handleTooFewVoters(g.subsidyCache, nextBlockHeight, payToAddress,
g.blockManager)
}
@ -1934,22 +1913,18 @@ mempoolLoop:
}
// Figure out stake version.
generatedStakeVersion, err :=
g.chain.CalcStakeVersionByHash(&prevHash)
generatedStakeVersion, err := g.chain.CalcStakeVersionByHash(&prevHash)
if err != nil {
return nil, err
}
// Create a new block ready to be solved.
merkles := blockchain.BuildMerkleTreeStore(blockTxnsRegular)
merklesStake := blockchain.BuildMerkleTreeStore(blockTxnsStake)
var msgBlock wire.MsgBlock
msgBlock.Header = wire.BlockHeader{
Version: blockVersion,
PrevBlock: prevHash,
MerkleRoot: *merkles[len(merkles)-1],
StakeRoot: *merklesStake[len(merklesStake)-1],
MerkleRoot: calcTxTreeMerkleRoot(blockTxnsRegular),
StakeRoot: calcTxTreeMerkleRoot(blockTxnsStake),
VoteBits: votebits,
FinalState: best.NextFinalState,
Voters: uint16(voters),
@ -1995,7 +1970,7 @@ mempoolLoop:
"%d bytes, target difficulty %064x, stake difficulty %v)",
len(msgBlock.Transactions), len(msgBlock.STransactions),
totalFees, blockSigOps, blockSize,
blockchain.CompactToBig(msgBlock.Header.Bits),
standalone.CompactToBig(msgBlock.Header.Bits),
dcrutil.Amount(msgBlock.Header.SBits).ToCoin())
blockTemplate := &BlockTemplate{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -10,7 +10,7 @@ import (
"math/rand"
"testing"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/blockchain/stake/v2"
)
// TestStakeTxFeePrioHeap tests the priority heaps including the stake types for

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018 The Decred developers
// Copyright (c) 2018-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -10,8 +10,8 @@ import (
"testing"
"github.com/decred/base58"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/chaincfg/v2"
)
// checkPowLimitsAreConsistent ensures PowLimit and PowLimitBits are consistent
@ -23,8 +23,8 @@ func checkPowLimitsAreConsistent(t *testing.T, params *chaincfg.Params) {
powLimitBigInt := params.PowLimit
powLimitCompact := params.PowLimitBits
toBig := blockchain.CompactToBig(powLimitCompact)
toCompact := blockchain.BigToCompact(powLimitBigInt)
toBig := standalone.CompactToBig(powLimitCompact)
toCompact := standalone.BigToCompact(powLimitBigInt)
// Check params.PowLimitBits matches params.PowLimit converted
// into the compact form
@ -56,7 +56,7 @@ func checkGenesisBlockRespectsNetworkPowLimit(t *testing.T, params *chaincfg.Par
bits := genesis.Header.Bits
// Header bits as big.Int
bitsAsBigInt := blockchain.CompactToBig(bits)
bitsAsBigInt := standalone.CompactToBig(bits)
// network PoW limit
powLimitBigInt := params.PowLimit
@ -125,18 +125,23 @@ func checkAddressPrefixesAreConsistent(t *testing.T, privateKeyPrefix string, pa
// TestDecredNetworkSettings checks Network-specific settings
func TestDecredNetworkSettings(t *testing.T) {
checkPowLimitsAreConsistent(t, &chaincfg.MainNetParams)
checkPowLimitsAreConsistent(t, &chaincfg.TestNet3Params)
checkPowLimitsAreConsistent(t, &chaincfg.SimNetParams)
checkPowLimitsAreConsistent(t, &chaincfg.RegNetParams)
mainNetParams := chaincfg.MainNetParams()
testNet3Params := chaincfg.TestNet3Params()
simNetParams := chaincfg.SimNetParams()
regNetParams := chaincfg.RegNetParams()
checkGenesisBlockRespectsNetworkPowLimit(t, &chaincfg.MainNetParams)
checkGenesisBlockRespectsNetworkPowLimit(t, &chaincfg.TestNet3Params)
checkGenesisBlockRespectsNetworkPowLimit(t, &chaincfg.SimNetParams)
checkGenesisBlockRespectsNetworkPowLimit(t, &chaincfg.RegNetParams)
checkPowLimitsAreConsistent(t, mainNetParams)
checkPowLimitsAreConsistent(t, testNet3Params)
checkPowLimitsAreConsistent(t, simNetParams)
checkPowLimitsAreConsistent(t, regNetParams)
checkAddressPrefixesAreConsistent(t, "Pm", &chaincfg.MainNetParams)
checkAddressPrefixesAreConsistent(t, "Pt", &chaincfg.TestNet3Params)
checkAddressPrefixesAreConsistent(t, "Ps", &chaincfg.SimNetParams)
checkAddressPrefixesAreConsistent(t, "Pr", &chaincfg.RegNetParams)
checkGenesisBlockRespectsNetworkPowLimit(t, mainNetParams)
checkGenesisBlockRespectsNetworkPowLimit(t, testNet3Params)
checkGenesisBlockRespectsNetworkPowLimit(t, simNetParams)
checkGenesisBlockRespectsNetworkPowLimit(t, regNetParams)
checkAddressPrefixesAreConsistent(t, "Pm", mainNetParams)
checkAddressPrefixesAreConsistent(t, "Pt", testNet3Params)
checkAddressPrefixesAreConsistent(t, "Ps", simNetParams)
checkAddressPrefixesAreConsistent(t, "Pr", regNetParams)
}

View File

@ -1,12 +1,12 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2018 The Decred developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/chaincfg/v2"
)
// activeNetParams is a pointer to the parameters specific to the
@ -27,27 +27,27 @@ type params struct {
// it does not handle on to dcrd. This approach allows the wallet process
// to emulate the full reference implementation RPC API.
var mainNetParams = params{
Params: &chaincfg.MainNetParams,
Params: chaincfg.MainNetParams(),
rpcPort: "9109",
}
// testNet3Params contains parameters specific to the test network (version 3)
// (wire.TestNet3).
var testNet3Params = params{
Params: &chaincfg.TestNet3Params,
Params: chaincfg.TestNet3Params(),
rpcPort: "19109",
}
// simNetParams contains parameters specific to the simulation test network
// (wire.SimNet).
var simNetParams = params{
Params: &chaincfg.SimNetParams,
Params: chaincfg.SimNetParams(),
rpcPort: "19556",
}
// regNetParams contains parameters specific to the regression test
// network (wire.RegNet).
var regNetParams = params{
Params: &chaincfg.RegNetParams,
Params: chaincfg.RegNetParams(),
rpcPort: "18656",
}

View File

@ -1150,7 +1150,7 @@ out:
}
case sccHandlerStart:
// Warn on unbalanced callback signalling.
// Warn on unbalanced callback signaling.
if handlerActive {
log.Warn("Received handler start " +
"control command while a " +
@ -1162,7 +1162,7 @@ out:
handlersStartTime = time.Now()
case sccHandlerDone:
// Warn on unbalanced callback signalling.
// Warn on unbalanced callback signaling.
if !handlerActive {
log.Warn("Received handler done " +
"control command when a " +

View File

@ -12,16 +12,5 @@
package main
import (
_ "github.com/decred/dcrd/blockchain/stake/v2"
_ "github.com/decred/dcrd/blockchain/standalone"
_ "github.com/decred/dcrd/blockchain/v2"
_ "github.com/decred/dcrd/chaincfg/v2"
_ "github.com/decred/dcrd/connmgr/v2"
_ "github.com/decred/dcrd/crypto/blake256"
_ "github.com/decred/dcrd/database/v2"
_ "github.com/decred/dcrd/dcrutil/v2"
_ "github.com/decred/dcrd/mempool/v3"
_ "github.com/decred/dcrd/mining/v2"
_ "github.com/decred/dcrd/peer/v2"
_ "github.com/decred/dcrd/txscript/v2"
_ "github.com/decred/dcrd/fees/v2"
)

View File

@ -35,28 +35,29 @@ import (
"github.com/gorilla/websocket"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/certgen"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/database/v2"
"github.com/decred/dcrd/dcrec/secp256k1"
"github.com/decred/dcrd/dcrjson/v3"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/internal/version"
"github.com/decred/dcrd/mempool/v2"
"github.com/decred/dcrd/mempool/v3"
"github.com/decred/dcrd/rpc/jsonrpc/types"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
"github.com/jrick/bitset"
)
// API version constants
const (
jsonrpcSemverString = "6.0.0"
jsonrpcSemverString = "6.1.0"
jsonrpcSemverMajor = 6
jsonrpcSemverMinor = 0
jsonrpcSemverMinor = 1
jsonrpcSemverPatch = 0
)
@ -673,26 +674,20 @@ func handleCreateRawTransaction(s *rpcServer, cmd interface{}, closeChan <-chan
"> %v", amount, dcrutil.MaxAmount)
}
// Decode the provided address.
addr, err := dcrutil.DecodeAddress(encodedAddr)
// Decode the provided address. This also ensures the network encoded
// with the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(encodedAddr, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode "+
"address: %v", err)
return nil, rpcAddressKeyError("Could not decode address: %v", err)
}
// Ensure the address is one of the supported types and that
// the network encoded with the address matches the network the
// server is currently on.
// Ensure the address is one of the supported types.
switch addr.(type) {
case *dcrutil.AddressPubKeyHash:
case *dcrutil.AddressScriptHash:
default:
return nil, rpcAddressKeyError("Invalid type: %T", addr)
}
if !addr.IsForNet(s.server.chainParams) {
return nil, rpcAddressKeyError("Wrong network: %v",
addr)
}
// Create a new script which pays to the provided address.
pkScript, err := txscript.PayToAddrScript(addr)
@ -783,26 +778,19 @@ func handleCreateRawSStx(s *rpcServer, cmd interface{}, closeChan <-chan struct{
dcrutil.MaxAmount)
}
// Decode the provided address.
addr, err := dcrutil.DecodeAddress(encodedAddr)
// Decode the provided address. This also ensures the network encoded
// with the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(encodedAddr, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode "+
"address: %v", err)
return nil, rpcAddressKeyError("Could not decode address: %v", err)
}
// Ensure the address is one of the supported types and that
// the network encoded with the address matches the network the
// server is currently on.
// Ensure the address is one of the supported types.
switch addr.(type) {
case *dcrutil.AddressPubKeyHash:
case *dcrutil.AddressScriptHash:
default:
return nil, rpcAddressKeyError("Invalid address type: "+
"%T", addr)
}
if !addr.IsForNet(s.server.chainParams) {
return nil, rpcAddressKeyError("Wrong network: %v",
addr)
return nil, rpcAddressKeyError("Invalid address type: %T", addr)
}
// Create a new script which pays to the provided address with an
@ -849,16 +837,15 @@ func handleCreateRawSStx(s *rpcServer, cmd interface{}, closeChan <-chan struct{
}
for i, cout := range c.COuts {
// 1. Append future commitment output.
addr, err := dcrutil.DecodeAddress(cout.Addr)
// Append future commitment output. This also ensures the network
// encoded with the address matches the network the server is currently
// on.
addr, err := dcrutil.DecodeAddress(cout.Addr, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode "+
"address: %v", err)
return nil, rpcAddressKeyError("Could not decode address: %v", err)
}
// Ensure the address is one of the supported types and that
// the network encoded with the address matches the network the
// server is currently on.
// Ensure the address is one of the supported types.
switch addr.(type) {
case *dcrutil.AddressPubKeyHash:
break
@ -867,10 +854,6 @@ func handleCreateRawSStx(s *rpcServer, cmd interface{}, closeChan <-chan struct{
default:
return nil, rpcAddressKeyError("Invalid type: %T", addr)
}
if !addr.IsForNet(s.server.chainParams) {
return nil, rpcAddressKeyError("Wrong network: %v",
addr)
}
// Create an OP_RETURN push containing the pubkeyhash to send
// rewards to. TODO Replace 0x0000 fee limits with an argument
@ -892,8 +875,9 @@ func handleCreateRawSStx(s *rpcServer, cmd interface{}, closeChan <-chan struct{
"> %v > %v", cout.ChangeAmt, dcrutil.MaxAmount)
}
// Decode the provided address.
addr, err = dcrutil.DecodeAddress(cout.ChangeAddr)
// Decode the provided address. This also ensures the network encoded
// with the address matches the network the server is currently on.
addr, err = dcrutil.DecodeAddress(cout.ChangeAddr, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Wrong network: %v",
addr)
@ -910,10 +894,6 @@ func handleCreateRawSStx(s *rpcServer, cmd interface{}, closeChan <-chan struct{
default:
return nil, rpcAddressKeyError("Invalid type: %T", addr)
}
if !addr.IsForNet(s.server.chainParams) {
return nil, rpcAddressKeyError("Wrong network: %v",
addr)
}
// Create a new script which pays to the provided address with
// an SStx change tagged output.
@ -1100,7 +1080,7 @@ func handleDebugLevel(s *rpcServer, cmd interface{}, closeChan <-chan struct{})
func createVinList(mtx *wire.MsgTx) []types.Vin {
// Coinbase transactions only have a single txin by definition.
vinList := make([]types.Vin, len(mtx.TxIn))
if blockchain.IsCoinBaseTx(mtx) {
if standalone.IsCoinBaseTx(mtx) {
txIn := mtx.TxIn[0]
vinEntry := &vinList[0]
vinEntry.Coinbase = hex.EncodeToString(txIn.SignatureScript)
@ -1202,7 +1182,7 @@ func createVoutList(mtx *wire.MsgTx, chainParams *chaincfg.Params, filterAddrMap
passesFilter := len(filterAddrMap) == 0
encodedAddrs := make([]string, len(addrs))
for j, addr := range addrs {
encodedAddr := addr.EncodeAddress()
encodedAddr := addr.Address()
encodedAddrs[j] = encodedAddr
// No need to check the map again if the filter already
@ -1338,7 +1318,7 @@ func handleDecodeScript(s *rpcServer, cmd interface{}, closeChan <-chan struct{}
scriptVersion, script, s.server.chainParams)
addresses := make([]string, len(addrs))
for i, addr := range addrs {
addresses[i] = addr.EncodeAddress()
addresses[i] = addr.Address()
}
// Convert the script itself to a pay-to-script-hash address.
@ -1356,7 +1336,7 @@ func handleDecodeScript(s *rpcServer, cmd interface{}, closeChan <-chan struct{}
Addresses: addresses,
}
if scriptClass != txscript.ScriptHashTy {
reply.P2sh = p2sh.EncodeAddress()
reply.P2sh = p2sh.Address()
}
return reply, nil
}
@ -1471,8 +1451,9 @@ func handleExistsAddress(s *rpcServer, cmd interface{}, closeChan <-chan struct{
c := cmd.(*types.ExistsAddressCmd)
// Attempt to decode the supplied address.
addr, err := dcrutil.DecodeAddress(c.Address)
// Decode the provided address. This also ensures the network encoded with
// the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(c.Address, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode address: %v",
err)
@ -1497,11 +1478,11 @@ func handleExistsAddresses(s *rpcServer, cmd interface{}, closeChan <-chan struc
c := cmd.(*types.ExistsAddressesCmd)
addresses := make([]dcrutil.Address, len(c.Addresses))
for i := range c.Addresses {
// Attempt to decode the supplied address.
addr, err := dcrutil.DecodeAddress(c.Addresses[i])
// Decode the provided address. This also ensures the network encoded
// with the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(c.Addresses[i], s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode "+
"address: %v", err)
return nil, rpcAddressKeyError("Could not decode address: %v", err)
}
addresses[i] = addr
}
@ -1805,8 +1786,8 @@ func getDifficultyRatio(bits uint32) float64 {
// converted back to a number. Note this is not the same as the proof
// of work limit directly because the block difficulty is encoded in a
// block with the compact form which loses precision.
max := blockchain.CompactToBig(activeNetParams.PowLimitBits)
target := blockchain.CompactToBig(bits)
max := standalone.CompactToBig(activeNetParams.PowLimitBits)
target := standalone.CompactToBig(bits)
difficulty := new(big.Rat).SetFrac(max, target)
outString := difficulty.FloatString(8)
@ -2138,17 +2119,9 @@ func handleGetBlockSubsidy(s *rpcServer, cmd interface{}, closeChan <-chan struc
height := c.Height
voters := c.Voters
cache := s.chain.FetchSubsidyCache()
if cache == nil {
return nil, rpcInternalError("empty subsidy cache", "")
}
dev := blockchain.CalcBlockTaxSubsidy(cache, height, voters,
s.server.chainParams)
pos := blockchain.CalcStakeVoteSubsidy(cache, height,
s.server.chainParams) * int64(voters)
pow := blockchain.CalcBlockWorkSubsidy(cache, height, voters,
s.server.chainParams)
dev := s.subsidyCache.CalcTreasurySubsidy(height, voters)
pos := s.subsidyCache.CalcStakeVoteSubsidy(height-1) * int64(voters)
pow := s.subsidyCache.CalcWorkSubsidy(height, voters)
total := dev + pos + pow
rep := types.GetBlockSubsidyResult{
@ -2365,7 +2338,7 @@ func (state *gbtWorkState) updateBlockTemplate(s *rpcServer, useCoinbaseValue bo
template = blkTemplate
msgBlock = template.Block
targetDifficulty = fmt.Sprintf("%064x",
blockchain.CompactToBig(msgBlock.Header.Bits))
standalone.CompactToBig(msgBlock.Header.Bits))
// Find the minimum allowed timestamp for the block based on the
// median timestamp of the last several blocks per the chain
@ -2416,15 +2389,15 @@ func (state *gbtWorkState) updateBlockTemplate(s *rpcServer, useCoinbaseValue bo
template.ValidPayAddress = true
// Update the merkle root.
block := dcrutil.NewBlock(template.Block)
merkles := blockchain.BuildMerkleTreeStore(block.Transactions())
template.Block.Header.MerkleRoot = *merkles[len(merkles)-1]
tplHeader := &template.Block.Header
tplTxns := template.Block.Transactions
tplHeader.MerkleRoot = standalone.CalcTxTreeMerkleRoot(tplTxns)
}
// Set locals for convenience.
msgBlock = template.Block
targetDifficulty = fmt.Sprintf("%064x",
blockchain.CompactToBig(msgBlock.Header.Bits))
standalone.CompactToBig(msgBlock.Header.Bits))
// Update the time of the block template to the current time
// while accounting for the median time of the past several
@ -2611,7 +2584,7 @@ func (state *gbtWorkState) blockTemplateResult(bm *blockManager, useCoinbaseValu
// are implied by the included or omission of fields:
// Including MinTime -> time/decrement
// Omitting CoinbaseTxn -> coinbase, generation
targetDifficulty := fmt.Sprintf("%064x", blockchain.CompactToBig(header.Bits))
targetDifficulty := fmt.Sprintf("%064x", standalone.CompactToBig(header.Bits))
templateID := encodeTemplateID(state.prevHash, state.lastGenerated)
reply := types.GetBlockTemplateResult{
Header: hex.EncodeToString(headerBytes),
@ -3039,7 +3012,7 @@ func handleGetChainTips(s *rpcServer, cmd interface{}, closeChan <-chan struct{}
// handleGetCoinSupply implements the getcoinsupply command.
func handleGetCoinSupply(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
return s.chain.TotalSubsidy(), nil
return s.chain.BestSnapshot().TotalSubsidy, nil
}
// handleGetConnectionCount implements the getconnectioncount command.
@ -3144,7 +3117,7 @@ func handleGetCFilterHeader(s *rpcServer, cmd interface{}, closeChan <-chan stru
return "", rpcInternalError(err.Error(), context)
}
if bytes.Equal(headerBytes, zeroHash[:]) && *hash !=
*s.server.chainParams.GenesisHash {
s.server.chainParams.GenesisHash {
return nil, &dcrjson.RPCError{
Code: dcrjson.ErrRPCBlockNotFound,
@ -3363,7 +3336,7 @@ func handleGetNetworkHashPS(s *rpcServer, cmd interface{}, closeChan <-chan stru
minTimestamp = header.Timestamp
maxTimestamp = minTimestamp
} else {
totalWork.Add(totalWork, blockchain.CalcWork(header.Bits))
totalWork.Add(totalWork, standalone.CalcWork(header.Bits))
if minTimestamp.After(header.Timestamp) {
minTimestamp = header.Timestamp
@ -3975,7 +3948,7 @@ func handleGetTxOut(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i
value = txOut.Value
scriptVersion = txOut.Version
pkScript = txOut.PkScript
isCoinbase = blockchain.IsCoinBaseTx(mtx)
isCoinbase = standalone.IsCoinBaseTx(mtx)
} else {
entry, err := s.chain.FetchUtxoEntry(txHash)
if err != nil {
@ -4014,7 +3987,7 @@ func handleGetTxOut(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i
script, s.server.chainParams)
addresses := make([]string, len(addrs))
for i, addr := range addrs {
addresses[i] = addr.EncodeAddress()
addresses[i] = addr.Address()
}
txOutReply := &types.GetTxOutResult{
@ -4113,7 +4086,7 @@ func handleGetWorkRequest(s *rpcServer) (interface{}, error) {
rpcsLog.Debugf("Generated block template (timestamp %v, extra "+
"nonce %d, target %064x, merkle root %s)",
msgBlock.Header.Timestamp, state.extraNonce,
blockchain.CompactToBig(msgBlock.Header.Bits),
standalone.CompactToBig(msgBlock.Header.Bits),
msgBlock.Header.MerkleRoot)
} else {
// At this point, there is a saved block template and a new
@ -4155,7 +4128,7 @@ func handleGetWorkRequest(s *rpcServer) (interface{}, error) {
"nonce %d, target %064x, merkle root %s)",
msgBlock.Header.Timestamp,
state.extraNonce,
blockchain.CompactToBig(msgBlock.Header.Bits),
standalone.CompactToBig(msgBlock.Header.Bits),
msgBlock.Header.MerkleRoot)
}
@ -4214,7 +4187,7 @@ func handleGetWorkRequest(s *rpcServer) (interface{}, error) {
// The fact the fields are reversed in this way is rather odd and likey
// an artifact of some legacy internal state in the reference
// implementation, but it is required for compatibility.
target := bigToLEUint256(blockchain.CompactToBig(msgBlock.Header.Bits))
target := bigToLEUint256(standalone.CompactToBig(msgBlock.Header.Bits))
reply := &types.GetWorkResult{
Data: hex.EncodeToString(data),
Target: hex.EncodeToString(target[:]),
@ -4286,7 +4259,8 @@ func handleGetWorkSubmission(s *rpcServer, hexData string) (interface{}, error)
block := dcrutil.NewBlock(&msgBlock)
// Ensure the submitted block hash is less than the target difficulty.
err = blockchain.CheckProofOfWork(&block.MsgBlock().Header,
blockHash := block.Hash()
err = standalone.CheckProofOfWork(blockHash, msgBlock.Header.Bits,
activeNetParams.PowLimit)
if err != nil {
// Anything other than a rule violation is an unexpected error,
@ -4611,7 +4585,7 @@ func fetchInputTxos(s *rpcServer, tx *wire.MsgTx) (map[wire.OutPoint]wire.TxOut,
// passed transaction.
func createVinListPrevOut(s *rpcServer, mtx *wire.MsgTx, chainParams *chaincfg.Params, vinExtra bool, filterAddrMap map[string]struct{}) ([]types.VinPrevOut, error) {
// Coinbase transactions only have a single txin by definition.
if blockchain.IsCoinBaseTx(mtx) {
if standalone.IsCoinBaseTx(mtx) {
// Only include the transaction if the filter map is empty
// because a coinbase input has no addresses and so would never
// match a non-empty filter.
@ -4710,7 +4684,7 @@ func createVinListPrevOut(s *rpcServer, mtx *wire.MsgTx, chainParams *chaincfg.P
// the filter when needed.
encodedAddrs := make([]string, len(addrs))
for j, addr := range addrs {
encodedAddr := addr.EncodeAddress()
encodedAddr := addr.Address()
encodedAddrs[j] = encodedAddr
// No need to check the map again if the filter already
@ -4794,8 +4768,9 @@ func handleSearchRawTransactions(s *rpcServer, cmd interface{}, closeChan <-chan
"enabled (--txindex)", "Configuration")
}
// Attempt to decode the supplied address.
addr, err := dcrutil.DecodeAddress(c.Address)
// Attempt to decode the supplied address. This also ensures the network
// encoded with the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(c.Address, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode address: %v",
err)
@ -5475,7 +5450,9 @@ func handleTicketFeeInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{
func handleTicketsForAddress(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*types.TicketsForAddressCmd)
addr, err := dcrutil.DecodeAddress(c.Address)
// Decode the provided address. This also ensures the network encoded
// with the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(c.Address, s.server.chainParams)
if err != nil {
return nil, rpcInvalidError("Invalid address: %v", err)
}
@ -5645,13 +5622,13 @@ func handleTxFeeInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (
func handleValidateAddress(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*types.ValidateAddressCmd)
result := types.ValidateAddressChainResult{}
addr, err := dcrutil.DecodeAddress(c.Address)
if err != nil || !addr.IsForNet(s.server.chainParams) {
addr, err := dcrutil.DecodeAddress(c.Address, s.server.chainParams)
if err != nil {
// Return the default value (false) for IsValid.
return result, nil
}
result.Address = addr.EncodeAddress()
result.Address = addr.Address()
result.IsValid = true
return result, nil
}
@ -5712,8 +5689,9 @@ func handleVerifyChain(s *rpcServer, cmd interface{}, closeChan <-chan struct{})
func handleVerifyMessage(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*types.VerifyMessageCmd)
// Decode the provided address.
addr, err := dcrutil.DecodeAddress(c.Address)
// Decode the provided address. This also ensures the network encoded with
// the address matches the network the server is currently on.
addr, err := dcrutil.DecodeAddress(c.Address, s.server.chainParams)
if err != nil {
return nil, rpcAddressKeyError("Could not decode address: %v",
err)
@ -5767,7 +5745,7 @@ func handleVerifyMessage(s *rpcServer, cmd interface{}, closeChan <-chan struct{
}
// Return boolean if addresses match.
return address.EncodeAddress() == c.Address, nil
return address.Address() == c.Address, nil
}
// handleVersion implements the version command.
@ -5805,6 +5783,7 @@ type rpcServer struct {
generator *BlkTmplGenerator
server *server
chain *blockchain.BlockChain
subsidyCache *standalone.SubsidyCache
authsha [sha256.Size]byte
limitauthsha [sha256.Size]byte
ntfnMgr *wsNotificationManager
@ -6449,6 +6428,7 @@ func newRPCServer(listenAddrs []string, generator *BlkTmplGenerator, s *server)
server: s,
generator: generator,
chain: s.chain,
subsidyCache: s.subsidyCache,
statusLines: make(map[int]string),
workState: newWorkState(),
templatePool: make(map[[merkleRootPairSize]byte]*workStateBlockInfo),

View File

@ -1,5 +1,6 @@
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2017 The Decred developers
// Copyright (c) 2017-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
@ -15,7 +16,7 @@ import (
"runtime/debug"
"testing"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/rpctest"
)
@ -108,7 +109,7 @@ func TestMain(m *testing.M) {
// ensure that non-standard transactions aren't accepted into the
// mempool or relayed.
args := []string{"--rejectnonstd"}
harness, err := rpctest.New(&chaincfg.RegNetParams, nil, args)
harness, err := rpctest.New(chaincfg.RegNetParams(), nil, args)
if err != nil {
fmt.Println("unable to create primary harness: ", err)
os.Exit(1)

View File

@ -11,14 +11,14 @@ import (
"fmt"
"sync"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/dcrec/secp256k1"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/hdkeychain/v2"
"github.com/decred/dcrd/rpcclient/v3"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/rpcclient/v4"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
)
@ -235,7 +235,7 @@ func (m *memWallet) chainSyncer() {
}
for _, tx := range update.filteredTxns {
mtx := tx.MsgTx()
isCoinbase := blockchain.IsCoinBaseTx(mtx)
isCoinbase := standalone.IsCoinBaseTx(mtx)
txHash := mtx.TxHash()
m.evalOutputs(mtx.TxOut, &txHash, isCoinbase, undo)
m.evalInputs(mtx.TxIn, undo)

View File

@ -17,7 +17,7 @@ import (
"time"
"github.com/decred/dcrd/certgen"
rpc "github.com/decred/dcrd/rpcclient/v3"
rpc "github.com/decred/dcrd/rpcclient/v4"
)
// nodeConfig contains all the args, and data required to launch a dcrd process

View File

@ -16,10 +16,10 @@ import (
"testing"
"time"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/rpcclient/v3"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/rpcclient/v4"
"github.com/decred/dcrd/wire"
)

View File

@ -14,11 +14,11 @@ import (
"testing"
"time"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrjson/v2"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/dcrutil/v2"
dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
)
@ -117,7 +117,7 @@ func assertConnectedTo(t *testing.T, nodeA *Harness, nodeB *Harness) {
func testConnectNode(r *Harness, t *testing.T) {
// Create a fresh test harness.
harness, err := New(&chaincfg.RegNetParams, nil, nil)
harness, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -159,7 +159,7 @@ func assertNotConnectedTo(t *testing.T, nodeA *Harness, nodeB *Harness) {
func testDisconnectNode(r *Harness, t *testing.T) {
// Create a fresh test harness.
harness, err := New(&chaincfg.RegNetParams, nil, nil)
harness, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -206,7 +206,7 @@ func testDisconnectNode(r *Harness, t *testing.T) {
func testNodesConnected(r *Harness, t *testing.T) {
// Create a fresh test harness.
harness, err := New(&chaincfg.RegNetParams, nil, nil)
harness, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -301,7 +301,7 @@ func testActiveHarnesses(r *Harness, t *testing.T) {
numInitialHarnesses := len(ActiveHarnesses())
// Create a single test harness.
harness1, err := New(&chaincfg.RegNetParams, nil, nil)
harness1, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -318,7 +318,7 @@ func testActiveHarnesses(r *Harness, t *testing.T) {
func testJoinMempools(r *Harness, t *testing.T) {
// Assert main test harness has no transactions in its mempool.
pooledHashes, err := r.Node.GetRawMempool(dcrjson.GRMAll)
pooledHashes, err := r.Node.GetRawMempool(dcrdtypes.GRMAll)
if err != nil {
t.Fatalf("unable to get mempool for main test harness: %v", err)
}
@ -329,7 +329,7 @@ func testJoinMempools(r *Harness, t *testing.T) {
// Create a local test harness with only the genesis block. The nodes
// will be synced below so the same transaction can be sent to both
// nodes without it being an orphan.
harness, err := New(&chaincfg.RegNetParams, nil, nil)
harness, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -370,7 +370,7 @@ func testJoinMempools(r *Harness, t *testing.T) {
harnessSynced := make(chan struct{})
go func() {
for {
poolHashes, err := r.Node.GetRawMempool(dcrjson.GRMAll)
poolHashes, err := r.Node.GetRawMempool(dcrdtypes.GRMAll)
if err != nil {
t.Fatalf("failed to retrieve harness mempool: %v", err)
}
@ -432,7 +432,7 @@ func testJoinMempools(r *Harness, t *testing.T) {
func testJoinBlocks(r *Harness, t *testing.T) {
// Create a second harness with only the genesis block so it is behind
// the main harness.
harness, err := New(&chaincfg.RegNetParams, nil, nil)
harness, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -479,7 +479,7 @@ func testJoinBlocks(r *Harness, t *testing.T) {
func testMemWalletReorg(r *Harness, t *testing.T) {
// Create a fresh harness, we'll be using the main harness to force a
// re-org on this local harness.
harness, err := New(&chaincfg.RegNetParams, nil, nil)
harness, err := New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
t.Fatal(err)
}
@ -572,7 +572,7 @@ var mainHarness *Harness
func TestMain(m *testing.M) {
var err error
mainHarness, err = New(&chaincfg.RegNetParams, nil, nil)
mainHarness, err = New(chaincfg.RegNetParams(), nil, nil)
if err != nil {
fmt.Println("unable to create main harness: ", err)
os.Exit(1)

View File

@ -9,8 +9,8 @@ import (
"reflect"
"time"
"github.com/decred/dcrd/dcrjson/v2"
"github.com/decred/dcrd/rpcclient/v3"
dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types"
"github.com/decred/dcrd/rpcclient/v4"
)
// JoinType is an enum representing a particular type of "node join". A node
@ -50,7 +50,7 @@ func syncMempools(nodes []*Harness) error {
for !poolsMatch {
retry:
firstPool, err := nodes[0].Node.GetRawMempool(dcrjson.GRMAll)
firstPool, err := nodes[0].Node.GetRawMempool(dcrdtypes.GRMAll)
if err != nil {
return err
}
@ -59,7 +59,7 @@ func syncMempools(nodes []*Harness) error {
// first node, then we're done. Otherwise, drop back to the top
// of the loop and retry after a short wait period.
for _, node := range nodes[1:] {
nodePool, err := node.Node.GetRawMempool(dcrjson.GRMAll)
nodePool, err := node.Node.GetRawMempool(dcrdtypes.GRMAll)
if err != nil {
return err
}

View File

@ -10,16 +10,16 @@ import (
"strings"
"time"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/dcrec"
"github.com/decred/dcrd/dcrec/secp256k1"
"github.com/decred/dcrd/dcrjson/v2"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/rpcclient/v3"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/dcrutil/v2"
dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types"
"github.com/decred/dcrd/rpcclient/v4"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
)
@ -111,7 +111,7 @@ type VotingWallet struct {
// the underlying harness' Generate().
miner func(uint32) ([]*chainhash.Hash, error)
subsidyCache *blockchain.SubsidyCache
subsidyCache *standalone.SubsidyCache
// utxos are the unspent outpoints not yet locked into a ticket.
utxos []utxoInfo
@ -185,7 +185,7 @@ func NewVotingWallet(hn *Harness) (*VotingWallet, error) {
commitmentScript: commitmentScript,
voteScript: voteScript,
voteReturnScript: voteReturnScript,
subsidyCache: blockchain.NewSubsidyCache(0, hn.ActiveNet),
subsidyCache: standalone.NewSubsidyCache(hn.ActiveNet),
tickets: make(map[chainhash.Hash]ticketInfo, hintTicketsCap),
maturingVotes: make(map[int64][]utxoInfo, hintMaturingVotesCap),
blockConnectedNtfnChan: make(chan blockConnectedNtfn, bufferLen),
@ -328,8 +328,8 @@ func (w *VotingWallet) GenerateBlocks(nb uint32) ([]*chainhash.Hash, error) {
for !gotAllReqs {
select {
case <-timeout:
mempoolTickets, _ := w.c.GetRawMempool(dcrjson.GRMTickets)
mempoolVotes, _ := w.c.GetRawMempool(dcrjson.GRMVotes)
mempoolTickets, _ := w.c.GetRawMempool(dcrdtypes.GRMTickets)
mempoolVotes, _ := w.c.GetRawMempool(dcrdtypes.GRMVotes)
var notGot []string
if len(mempoolVotes) != nbVotes {
notGot = append(notGot, "votes")
@ -343,8 +343,8 @@ func (w *VotingWallet) GenerateBlocks(nb uint32) ([]*chainhash.Hash, error) {
case <-w.quitChan:
return nil, fmt.Errorf("wallet is stopping")
case <-testTimeout:
mempoolTickets, _ := w.c.GetRawMempool(dcrjson.GRMTickets)
mempoolVotes, _ := w.c.GetRawMempool(dcrjson.GRMVotes)
mempoolTickets, _ := w.c.GetRawMempool(dcrdtypes.GRMTickets)
mempoolVotes, _ := w.c.GetRawMempool(dcrdtypes.GRMVotes)
gotAllReqs = (!needsTickets || (len(mempoolTickets) >= nbVotes)) &&
(!needsVotes || (len(mempoolVotes) >= nbVotes))
@ -474,9 +474,7 @@ func (w *VotingWallet) handleWinningTicketsNtfn(ntfn *winningTicketsNtfn) {
voteScript := w.voteScript
voteReturnScript := w.voteReturnScript
stakebaseValue := blockchain.CalcStakeVoteSubsidy(
w.subsidyCache, ntfn.blockHeight, w.hn.ActiveNet,
)
stakebaseValue := w.subsidyCache.CalcStakeVoteSubsidy(ntfn.blockHeight)
// Create the votes. nbVotes is the number of tickets from the wallet that
// voted.

View File

@ -11,8 +11,8 @@ import (
"os"
"testing"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/rpcclient/v3"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/rpcclient/v4"
)
// testCanPassSVH tests whether the wallet can maintain the chain going past SVH
@ -60,7 +60,7 @@ func TestMinimalVotingWallet(t *testing.T) {
}
var handlers *rpcclient.NotificationHandlers
net := &chaincfg.SimNetParams
net := chaincfg.SimNetParams()
logDir := "./dcrdlogs"
extraArgs := []string{

View File

@ -22,13 +22,14 @@ import (
"github.com/gorilla/websocket"
"golang.org/x/crypto/ripemd160"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/dcrjson/v3"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/rpc/jsonrpc/types"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
)
@ -333,6 +334,9 @@ type StakeDifficultyNtfnData struct {
type wsClientFilter struct {
mu sync.Mutex
// Parameter for address decoding.
params dcrutil.AddressParams
// Implemented fast paths for address lookup.
pubKeyHashes map[[ripemd160.Size]byte]struct{}
scriptHashes map[[ripemd160.Size]byte]struct{}
@ -348,8 +352,9 @@ type wsClientFilter struct {
unspent map[wire.OutPoint]struct{}
}
func makeWSClientFilter(addresses []string, unspentOutPoints []*wire.OutPoint) *wsClientFilter {
func makeWSClientFilter(addresses []string, unspentOutPoints []*wire.OutPoint, params dcrutil.AddressParams) *wsClientFilter {
filter := &wsClientFilter{
params: params,
pubKeyHashes: map[[ripemd160.Size]byte]struct{}{},
scriptHashes: map[[ripemd160.Size]byte]struct{}{},
compressedPubKeys: map[[33]byte]struct{}{},
@ -392,11 +397,11 @@ func (f *wsClientFilter) addAddress(a dcrutil.Address) {
}
}
f.otherAddresses[a.EncodeAddress()] = struct{}{}
f.otherAddresses[a.Address()] = struct{}{}
}
func (f *wsClientFilter) addAddressStr(s string) {
a, err := dcrutil.DecodeAddress(s)
a, err := dcrutil.DecodeAddress(s, f.params)
// If address can't be decoded, no point in saving it since it should also
// impossible to create the address from an inspected transaction output
// script.
@ -436,7 +441,7 @@ func (f *wsClientFilter) existsAddress(a dcrutil.Address) bool {
}
}
_, ok := f.otherAddresses[a.EncodeAddress()]
_, ok := f.otherAddresses[a.Address()]
return ok
}
@ -674,8 +679,7 @@ func (m *wsNotificationManager) subscribedClients(tx *dcrutil.Tx, clients map[ch
}
for i, output := range msgTx.TxOut {
_, addrs, _, err := txscript.ExtractPkScriptAddrs(
txscript.DefaultScriptVersion,
_, addrs, _, err := txscript.ExtractPkScriptAddrs(output.Version,
output.PkScript, m.server.server.chainParams)
if err != nil {
// Clients are not able to subscribe to
@ -1991,7 +1995,8 @@ func handleLoadTxFilter(wsc *wsClient, icmd interface{}) (interface{}, error) {
wsc.Lock()
if cmd.Reload || wsc.filterData == nil {
wsc.filterData = makeWSClientFilter(cmd.Addresses, outPoints)
wsc.filterData = makeWSClientFilter(cmd.Addresses, outPoints,
wsc.server.server.chainParams)
wsc.Unlock()
} else {
filter := wsc.filterData
@ -2100,7 +2105,7 @@ func rescanBlock(filter *wsClientFilter, block *dcrutil.Block) []string {
if tree == wire.TxTreeRegular {
// Skip previous output checks for coinbase inputs. These do
// not reference a previous output.
if blockchain.IsCoinBaseTx(tx) {
if standalone.IsCoinBaseTx(tx) {
goto LoopOutputs
}
} else {

View File

@ -22,23 +22,24 @@ import (
"time"
"github.com/decred/dcrd/addrmgr"
"github.com/decred/dcrd/blockchain"
"github.com/decred/dcrd/blockchain/indexers"
"github.com/decred/dcrd/blockchain/stake"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/blockchain/stake/v2"
"github.com/decred/dcrd/blockchain/standalone"
"github.com/decred/dcrd/blockchain/v2"
"github.com/decred/dcrd/blockchain/v2/indexers"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/connmgr"
"github.com/decred/dcrd/database"
"github.com/decred/dcrd/dcrutil"
"github.com/decred/dcrd/fees"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decred/dcrd/connmgr/v2"
"github.com/decred/dcrd/database/v2"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/fees/v2"
"github.com/decred/dcrd/gcs"
"github.com/decred/dcrd/gcs/blockcf"
"github.com/decred/dcrd/internal/version"
"github.com/decred/dcrd/lru"
"github.com/decred/dcrd/mempool/v2"
"github.com/decred/dcrd/mining"
"github.com/decred/dcrd/peer"
"github.com/decred/dcrd/txscript"
"github.com/decred/dcrd/mempool/v3"
"github.com/decred/dcrd/mining/v2"
"github.com/decred/dcrd/peer/v2"
"github.com/decred/dcrd/txscript/v2"
"github.com/decred/dcrd/wire"
)
@ -191,6 +192,7 @@ type server struct {
addrManager *addrmgr.AddrManager
connManager *connmgr.ConnManager
sigCache *txscript.SigCache
subsidyCache *standalone.SubsidyCache
rpcServer *rpcServer
blockManager *blockManager
bg *BgBlkTmplGenerator
@ -1771,7 +1773,14 @@ func (s *server) peerHandler() {
if !cfg.DisableDNSSeed {
// Add peers discovered through DNS to the address manager.
connmgr.SeedFromDNS(activeNetParams.Params, defaultRequiredServices, dcrdLookup, func(addrs []*wire.NetAddress) {
params := activeNetParams.Params
seeds := make([]string, 0, len(params.DNSSeeds))
for _, seed := range params.DNSSeeds {
seeds = append(seeds, seed.Host)
}
defaultPort, _ := strconv.Atoi(params.DefaultPort)
connmgr.SeedFromDNS(seeds, uint16(defaultPort), defaultRequiredServices,
dcrdLookup, func(addrs []*wire.NetAddress) {
// Bitcoind uses a lookup of the dns seeder here. This
// is rather strange since the values looked up by the
// DNS seed lookups will vary quite a lot.
@ -2478,6 +2487,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
timeSource: blockchain.NewMedianTime(),
services: services,
sigCache: txscript.NewSigCache(cfg.SigCacheMaxSize),
subsidyCache: standalone.NewSubsidyCache(chainParams),
context: ctx,
cancel: cancel,
}
@ -2557,6 +2567,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
}
},
SigCache: s.sigCache,
SubsidyCache: s.subsidyCache,
IndexManager: indexManager,
})
if err != nil {
@ -2588,7 +2599,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
BestHash: func() *chainhash.Hash { return &s.chain.BestSnapshot().Hash },
BestHeight: func() int64 { return s.chain.BestSnapshot().Height },
CalcSequenceLock: s.chain.CalcSequenceLock,
SubsidyCache: s.chain.FetchSubsidyCache(),
SubsidyCache: s.subsidyCache,
SigCache: s.sigCache,
PastMedianTime: func() time.Time {
return s.chain.BestSnapshot().MedianTime
@ -2608,6 +2619,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
PeerNotifier: &s,
Chain: s.chain,
ChainParams: s.chainParams,
SubsidyCache: s.subsidyCache,
TimeSource: s.timeSource,
FeeEstimator: s.feeEstimator,
TxMemPool: s.txMemPool,
@ -2638,7 +2650,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
TxMinFreeFee: cfg.minRelayTxFee,
}
tg := newBlkTmplGenerator(&policy, s.txMemPool, s.timeSource, s.sigCache,
s.chainParams, s.chain, s.blockManager)
s.subsidyCache, s.chainParams, s.chain, s.blockManager)
// Create the background block template generator if the config has a
// mining address.