-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client: bitcoin spv #1230
Merged
Merged
client: bitcoin spv #1230
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2a591a5
bitcoin spv
buck54321 4a27537
remove hashmap
buck54321 7e13921
drop spendingTxs cache. add scan checkpoint cache
buck54321 284052b
nest nil blockHash check. use []byte passwords everywhere
buck54321 5c34c9a
chappjc review followup 1
buck54321 e13925f
remove dev docs
buck54321 c1046e3
review followup 2.1, send sendToAddress with subtract
buck54321 2b6ecf8
review followup 3
buck54321 5084c09
backend teardown
buck54321 f5c5c38
review followup 4
buck54321 47e512a
refactor Driver interfaces
buck54321 856ee5b
localization. fix shutdown bug
buck54321 8ac1c89
require package init
buck54321 644c1e5
clarify Seeded field description
buck54321 af38f4c
checkpoint
buck54321 97f7a39
most of wisdoms review
buck54321 55daa99
chappjc 5
buck54321 f147edf
better logNeutrino sequence
buck54321 5c71c93
modify trade_simnet_test to use btc spv wallet
itswisdomagain 350557b
more joegruffins review
buck54321 d316157
reconfig bug. CoinNotFoundError return value bug
buck54321 010b451
rotator shant die
buck54321 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,9 +33,16 @@ const ( | |
// structure. | ||
defaultFee = 100 | ||
minNetworkVersion = 221100 | ||
walletTypeRPC = "bitcoindRPC" | ||
walletTypeLegacy = "" | ||
) | ||
|
||
var ( | ||
netPorts = dexbtc.NetPorts{ | ||
Mainnet: "8332", | ||
Testnet: "18332", | ||
Simnet: "18443", | ||
} | ||
fallbackFeeKey = "fallbackfee" | ||
configOpts = []*asset.ConfigOption{ | ||
{ | ||
|
@@ -85,9 +92,14 @@ var ( | |
Name: "Bitcoin Cash", | ||
Version: version, | ||
// Same as bitcoin. That's dumb. | ||
DefaultConfigPath: dexbtc.SystemConfigPath("bitcoin"), | ||
ConfigOpts: configOpts, | ||
UnitInfo: dexbch.UnitInfo, | ||
UnitInfo: dexbch.UnitInfo, | ||
AvailableWallets: []*asset.WalletDefinition{{ | ||
Type: walletTypeRPC, | ||
Tab: "External", | ||
Description: "Connect to bitcoind", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also uses a |
||
DefaultConfigPath: dexbtc.SystemConfigPath("bitcoin"), // Same as bitcoin. That's dumb. | ||
ConfigOpts: configOpts, | ||
}}, | ||
} | ||
) | ||
|
||
|
@@ -98,15 +110,14 @@ func init() { | |
// Driver implements asset.Driver. | ||
type Driver struct{} | ||
|
||
// Open opens the BCH exchange wallet. Start the wallet with its Run method. | ||
// Check that Driver implements asset.Driver. | ||
var _ asset.Driver = (*Driver)(nil) | ||
|
||
// Open creates the BCH exchange wallet. Start the wallet with its Run method. | ||
func (d *Driver) Open(cfg *asset.WalletConfig, logger dex.Logger, network dex.Network) (asset.Wallet, error) { | ||
return NewWallet(cfg, logger, network) | ||
} | ||
|
||
func (d *Driver) Create(params *asset.CreateWalletParams) error { | ||
return fmt.Errorf("no creatable wallet types") | ||
} | ||
|
||
// DecodeCoinID creates a human-readable representation of a coin ID for | ||
// Bitcoin Cash. | ||
func (d *Driver) DecodeCoinID(coinID []byte) (string, error) { | ||
|
@@ -120,9 +131,7 @@ func (d *Driver) Info() *asset.WalletInfo { | |
} | ||
|
||
// NewWallet is the exported constructor by which the DEX will import the | ||
// exchange wallet. The wallet will shut down when the provided context is | ||
// canceled. The configPath can be an empty string, in which case the standard | ||
// system location of the daemon config file is assumed. | ||
// exchange wallet. | ||
func NewWallet(cfg *asset.WalletConfig, logger dex.Logger, network dex.Network) (asset.Wallet, error) { | ||
var params *chaincfg.Params | ||
switch network { | ||
|
@@ -139,11 +148,6 @@ func NewWallet(cfg *asset.WalletConfig, logger dex.Logger, network dex.Network) | |
// Designate the clone ports. These will be overwritten by any explicit | ||
// settings in the configuration file. Bitcoin Cash uses the same default | ||
// ports as Bitcoin. | ||
ports := dexbtc.NetPorts{ | ||
Mainnet: "8332", | ||
Testnet: "18332", | ||
Simnet: "18443", | ||
} | ||
cloneCFG := &btc.BTCCloneCFG{ | ||
WalletCFG: cfg, | ||
MinNetworkVersion: minNetworkVersion, | ||
|
@@ -152,7 +156,7 @@ func NewWallet(cfg *asset.WalletConfig, logger dex.Logger, network dex.Network) | |
Logger: logger, | ||
Network: network, | ||
ChainParams: params, | ||
Ports: ports, | ||
Ports: netPorts, | ||
DefaultFallbackFee: defaultFee, | ||
Segwit: false, | ||
LegacyBalance: true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a biggie, but doesn't this increase the scope and lifetime of this variable, compared to when it was just local to a function?