-
Notifications
You must be signed in to change notification settings - Fork 104
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
zec: implement zip 317 #2338
zec: implement zip 317 #2338
Conversation
5385420
to
eb2af19
Compare
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.
It's looking good to me. Still need to test though.
server/asset/btc/tx.go
Outdated
@@ -26,6 +26,9 @@ type Tx struct { | |||
// Used to conditionally skip block lookups on mempool transactions during | |||
// calls to Confirmations. | |||
lastLookup *chainhash.Hash | |||
// fees is the fees paid in the tx. fees is used Zcash. It is exposed by the |
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.
*fees is used by Zcash
// Satisfies the asset.OrderEstimator interface. | ||
func (be *ZECBackend) CalcOrderFunds(swapVal, inputCount, inputsSize, maxSwaps uint64) uint64 { | ||
return dexzec.RequiredOrderFunds(swapVal, inputCount, inputsSize, maxSwaps) | ||
} |
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.
var _ asset.OrderEstimator = (*ZECBackend)(nil)
docs/images/zip-0317.tex
Outdated
@@ -0,0 +1,20 @@ | |||
\documentclass[]{article} |
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.
Why don't we just link to the ZIP 317 page? I don't think we need to check in a 120 KB png file either.
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.
Ooooh. I was reading at https://github.com/zcash/zips/blob/main/zip-0317.rst, where the tex doesn't render
@@ -4951,11 +5031,10 @@ var dummyP2PKHScript = []byte{0x76, 0xa9, 0x14, 0xe4, 0x28, 0x61, 0xa, | |||
|
|||
// EstimateSendTxFee returns a tx fee estimate for sending or withdrawing the | |||
// provided amount using the provided feeRate. | |||
func (btc *intermediaryWallet) EstimateSendTxFee(address string, sendAmount, feeRate uint64, subtract bool) (fee uint64, isValidAddress bool, err error) { | |||
func (btc *baseWallet) EstimateSendTxFee(address string, sendAmount, feeRate uint64, subtract bool) (fee uint64, isValidAddress bool, err error) { |
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.
This makes the electrum wallets TxFeeEstimator
s. Anything wrong with that @chappjc?
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 in principle. With your move of estimateSendTxFee
to be a baseWallet
method, it looks like the existing (*electrumWallet).listUnspent
is adequate.
86a225e
to
c5eeb35
Compare
Replaced by #2553 |
Adds support for ZIP-0317 fee calculations, though we've always done fees for Zcash wrong. Previously, fee should have been 1000 zats per tx, regardless of size. Now, fees are 5000 zats per "logical action".
Making these calculations possible required a pretty deep integration. I've tried to do so in a way that makes this easy to review. This has been roughly tested manually.