Skip to content
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

Accept external URL for neutrino fee estimation. #2900

Merged
merged 6 commits into from Apr 17, 2019

Conversation

valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Apr 6, 2019

In this commit, we enable neutrino users to specify a URL where fee
information can be retrieved for on-chain transactions.

The fee information must be a JSON object mapping fee_by_block_target
to fee information, e.g:

{
	fee_by_block_target: {
		2: 105804,
		4: 91720,
		...
		604: 1012
	}
}

The object nested in fee_by_block_target maps a number of confs to a
fee (in satoshis per kilovbyte). Note that the API's fee information need
not start at zero confs, and only fees up to 1009 confirmations are
cached/used. The reason for this is because 1009 confirmations is the
maximum number of confs that bitcoind will return an estimate for.

Also, there may be gaps in the fee information: if the API's response
contains a fee for 2 confs and then a fee for 6 confs, it is assumed that
the fee for 3 through 5 confs is the same as the fee for 2 confs.

@valentinewallace valentinewallace force-pushed the neutrino-fee-est branch 2 times, most recently from 72762de to dcdd33e Compare April 7, 2019 01:53
chainregistry.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
@valentinewallace valentinewallace force-pushed the neutrino-fee-est branch 3 times, most recently from d248d83 to 570ac25 Compare April 9, 2019 18:27
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Show resolved Hide resolved
@valentinewallace valentinewallace force-pushed the neutrino-fee-est branch 4 times, most recently from ff87ffc to 9d3a912 Compare April 11, 2019 00:57
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator_test.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator_test.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator_test.go Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
config.go Outdated Show resolved Hide resolved
chainregistry.go Show resolved Hide resolved
lnwallet/fee_estimator_test.go Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator.go Outdated Show resolved Hide resolved
lnwallet/fee_estimator_test.go Outdated Show resolved Hide resolved
Roasbeef and others added 2 commits April 16, 2019 13:50
In this commit, we add a new interface which will allow callers to drop
in an arbitrary Web API for fee estimation with an arbitrary
request/response schema.

Co-authored-by: Valentine Wallace <vwallace@protonmail.com>
This enables users to specify an external API for fee estimation.
The API is expected to return fees in the JSON format:
`{
	fee_by_block_target: {
	   a: x,
	   b: y,
	   ...
	   c: z
        }
 }`
 where a, b, c are block targets and x, y, z are fees in sat/kb.
 Note that a, b, c need not be contiguous.
@valentinewallace valentinewallace force-pushed the neutrino-fee-est branch 2 times, most recently from 277b889 to 12c4e06 Compare April 16, 2019 21:14
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@Roasbeef Roasbeef merged commit e396b55 into lightningnetwork:master Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants