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

Projects
None yet
3 participants
@valentinewallace
Copy link
Collaborator

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 valentinewallace:neutrino-fee-est branch 2 times, most recently from 72762de to dcdd33e Apr 7, 2019

Show resolved Hide resolved 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

@valentinewallace valentinewallace force-pushed the valentinewallace:neutrino-fee-est branch 3 times, most recently from d248d83 to 570ac25 Apr 9, 2019

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 Outdated
Show resolved Hide resolved lnwallet/fee_estimator.go

@valentinewallace valentinewallace force-pushed the valentinewallace:neutrino-fee-est branch 4 times, most recently from ff87ffc to 9d3a912 Apr 10, 2019

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 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

@valentinewallace valentinewallace force-pushed the valentinewallace:neutrino-fee-est branch from 9d3a912 to 1b0321c Apr 12, 2019

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

Roasbeef and others added some commits Sep 10, 2018

lnwallet: add new WebApiFeeSource interface
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>
lnwallet: add implementation of WebApiFeeSource for external APIs
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 valentinewallace:neutrino-fee-est branch 2 times, most recently from 277b889 to 12c4e06 Apr 16, 2019

@valentinewallace valentinewallace force-pushed the valentinewallace:neutrino-fee-est branch from 12c4e06 to 16aad1a Apr 16, 2019

@Roasbeef
Copy link
Member

left a comment

LGTM 🎉

@Roasbeef Roasbeef merged commit e396b55 into lightningnetwork:master Apr 17, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.02%) to 59.824%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.