Skip to content

Conversation

@daniel-savu
Copy link

Follow up to this conversation: Blockstream/esplora#267

Adds a CLI flag (--index-unspendables) that relaxes filtering for transactions that will be indexed in electrs. More specifically, when this flag is enabled transactions with provably unspendable outputs are also indexed.

@shesek
Copy link
Collaborator

shesek commented Oct 28, 2020

Looks good, thanks! I only have a couple of very small non-code nits, will merge once they're fixed.

@shesek shesek merged commit 085872d into Blockstream:new-index Oct 29, 2020
@shesek
Copy link
Collaborator

shesek commented Oct 29, 2020

Merged. Thanks for the contribution!

ghost referenced this pull request in cryptogarageinc/electrs Jan 5, 2021
* Use newly added AssetId::from_slice()

* Display a more useful error message

* Electrum: Implement server.features RPC method

Using a new --electrum-public-hosts argument for specifying the public
hosts where the server is reachable (as a JSON dictionary).

* Electrum: Make the banner configurable via --electrum-banner

* Electrum: Implement dummy `server.add_peer` method

* Change dummy server.add_peer to return true

* Add a maximum pre-address utxos limit

The limit applies if the utxo set of an address exceeds the limit at any point in history.

Set to 500 by default, can be configured with --utxos-limit.

* Increase the default --electrum-txs-limit to 500

* Support triggering a real-time sync using SIGUSR1

To be used with bitcoind's blocknotify functionality, with something like:

    blocknotify=pkill -USR1 electrs

* Add some missing Prometheus instrumentations

* Expose underlying error messages instead of a generic error

* Initiate "never" signal only once

* Remove unused code and outdated tests

* Move electrum into a submodule

* Implement Electrum server discovery

Adds the `server.add_peer` and `server.peers.subscribe` RPC commands to
support discovery of other servers, with a mechanism for running
scheduled health checks and verifying the servers availability.

* Make electrum server discovery optional at runtime

Enabled when --electrum-public-hosts is set, disabled otherwise.

* Minor comments/messages/formatting changes

* Give unavailable default servers some more leniency, but don't keep retrying them *forever*

* Refactor DiscoveryManager

* Rename health_check -> job

* Avoid listing ourselves

* Initialize our ServerFeatures once and share it

* electrum: Announce ourselves to the servers we're connecting to

* electrum: Track the number of connected clients with Prometheus

* electrum: Don't error in add_peer when there are no new entries

* electrum: Reject add_peer requests with loopback, local, multicast or unspecified IP address types

* Shortem /mempool/recent TTL for 5 seconds

* Reset the client count to 0 on startup

* docs: Update README with new CLI options

* docs: Update current index storage requirements

* fix: Properly track the number of subscribed scripthashes

* electrum: Report the fee of mempool transactions

Refs spesmilo/electrum#6289

* electrum: Use height of -1 for transactions with unconfirmed parents

* refactor: Remove unnecessary conversions

* Add a 'blocks_dir' option analogous to bitcoind's '-blocksdir'

The '-blocksdir' startup option allows one to store blk*.dat on an
external disk, while keeping the index (blocks/index/) on the same disk.

This makes electrs aware of such an option, while still keeping the same
default behaviour (blk*.dat in '<config_dir>/blocks/').

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>

* remove unused dep

* limit max open files per db

* increase db target file size

* increase rocksdb version to 0.14.0

* remove unused lru dep

* remove extern crate as in edition 2018 they are not needed

* remove warning in oldcpu feature

* set backlog size to 511

adds socket2 crates so that we have access to more settings of the underlying
socket.

* use socket with backlog also for hyper

* Hardcode the fee estimates in regtest to use the relay fee

* Upgrade to hyper v0.13 with tokio v0.2

* Update direct crate dependencies

* Run cargo update

* Enable SO_REUSEPORT

* Switch back to the deprecated bincode::config()

Investigating if that's related to the new "failed to deserialize
TxHistoryKey: Custom(\"invalid value: integer `9`, expected variant
index 0 <= i < 2\")" error messages that started showing up.

* Add support for binding the HTTP server on a unix socket (#26)

* use socket file if passed in

* fixup

* cargo fmt

* Typing fixups

* Hide the --http-socket-file option on non-unix systems

Co-authored-by: Nadav Ivgi <nadav@shesek.info>

* Replace async-std::task -> tokio::task

* Replace tokio::task -> std::thread

* remove assert since it's an upsert

* Fix log typo (#27)

* Verify http-socket-file is a socket before deleting it

* Implement /asset/:asset/supply[/decimal] endpoints

* Don't deadlock when shutting down

Backported from upstream electrs:

- romanz@a3bfdda
- romanz@0f3aaa6

* Switch to `signal-hook` crate from deprecated `chan-signal`

Backported from upstream electrs: romanz@2286efb

* Fix bug introduced in the last commit

* Add additional elements-only fields to the UTXO endpoint

`nonce`, `surjection_proof` and `range_proof`

Refs Blockstream/esplora#217

* electrum: Ignore out-of-bounds block heights in block.headers

 As per the specs:
 > If the chain has not extended sufficiently far, only the available headers will be returned.

* electrum: Limit the number of returned headers

The `max` field indicated that a limit exists, but it was not enforced.

* Remove outdated Dockerfile

Refs Blockstream/esplora#45

* elements: Implement in-memory asset store and `GET /assets/registry`

* Use is_spendable() more consistently

* Add index-unspendables CLI flag (#28)

* http: Implement GET /block/:hash/header

* Add median time past to blocks json

* Make asset sorting case insensitive

The domain name doesn't need lower-casing because its
guaranteed to be in all lowercase.

* Fix get_fee_histogram

romanz@c88a0dc

* Fix ordering by asset ticker

* Fix get_block_header() in liquid mode

Liquid's BlockHeaders are not Copyable

* Return the total number of available registered assets

As the `X-Total-Results` header, in reply to `GET /assets/registry`

* Can derive Default

* add Dockerfile

* remove unused line

* add github action

* modified tag format for push image

* fix getting short-sha and tagname

* add sample CMD

* update to push to dockerhub

* fix github action

* add fetch-depth:0 to checkout action

* remove unused line

* 実験用に指定していた branch 指定を削除

* レビューコメントに対応

* 動作確認用のブランチ指定を削除

Co-authored-by: Nadav Ivgi <nadav@shesek.info>
Co-authored-by: Antoine Poinsot <darosior@protonmail.com>
Co-authored-by: Riccardo Casatta <riccardo@casatta.it>
Co-authored-by: GreenAddress <greenaddress@users.noreply.github.com>
Co-authored-by: Steven Zhao <steven@zhao.io>
Co-authored-by: Daniel Savu <savudani04@yahoo.ro>
dgyoshi referenced this pull request in cryptogarageinc/electrs Sep 14, 2021
* Use newly added AssetId::from_slice()

* Display a more useful error message

* Electrum: Implement server.features RPC method

Using a new --electrum-public-hosts argument for specifying the public
hosts where the server is reachable (as a JSON dictionary).

* Electrum: Make the banner configurable via --electrum-banner

* Electrum: Implement dummy `server.add_peer` method

* Change dummy server.add_peer to return true

* Add a maximum pre-address utxos limit

The limit applies if the utxo set of an address exceeds the limit at any point in history.

Set to 500 by default, can be configured with --utxos-limit.

* Increase the default --electrum-txs-limit to 500

* Support triggering a real-time sync using SIGUSR1

To be used with bitcoind's blocknotify functionality, with something like:

    blocknotify=pkill -USR1 electrs

* Add some missing Prometheus instrumentations

* Expose underlying error messages instead of a generic error

* Initiate "never" signal only once

* Remove unused code and outdated tests

* Move electrum into a submodule

* Implement Electrum server discovery

Adds the `server.add_peer` and `server.peers.subscribe` RPC commands to
support discovery of other servers, with a mechanism for running
scheduled health checks and verifying the servers availability.

* Make electrum server discovery optional at runtime

Enabled when --electrum-public-hosts is set, disabled otherwise.

* Minor comments/messages/formatting changes

* Give unavailable default servers some more leniency, but don't keep retrying them *forever*

* Refactor DiscoveryManager

* Rename health_check -> job

* Avoid listing ourselves

* Initialize our ServerFeatures once and share it

* electrum: Announce ourselves to the servers we're connecting to

* electrum: Track the number of connected clients with Prometheus

* electrum: Don't error in add_peer when there are no new entries

* electrum: Reject add_peer requests with loopback, local, multicast or unspecified IP address types

* Shortem /mempool/recent TTL for 5 seconds

* Reset the client count to 0 on startup

* docs: Update README with new CLI options

* docs: Update current index storage requirements

* fix: Properly track the number of subscribed scripthashes

* electrum: Report the fee of mempool transactions

Refs spesmilo/electrum#6289

* electrum: Use height of -1 for transactions with unconfirmed parents

* refactor: Remove unnecessary conversions

* Add a 'blocks_dir' option analogous to bitcoind's '-blocksdir'

The '-blocksdir' startup option allows one to store blk*.dat on an
external disk, while keeping the index (blocks/index/) on the same disk.

This makes electrs aware of such an option, while still keeping the same
default behaviour (blk*.dat in '<config_dir>/blocks/').

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>

* remove unused dep

* limit max open files per db

* increase db target file size

* increase rocksdb version to 0.14.0

* remove unused lru dep

* remove extern crate as in edition 2018 they are not needed

* remove warning in oldcpu feature

* set backlog size to 511

adds socket2 crates so that we have access to more settings of the underlying
socket.

* use socket with backlog also for hyper

* Hardcode the fee estimates in regtest to use the relay fee

* Upgrade to hyper v0.13 with tokio v0.2

* Update direct crate dependencies

* Run cargo update

* Enable SO_REUSEPORT

* Switch back to the deprecated bincode::config()

Investigating if that's related to the new "failed to deserialize
TxHistoryKey: Custom(\"invalid value: integer `9`, expected variant
index 0 <= i < 2\")" error messages that started showing up.

* Add support for binding the HTTP server on a unix socket (#26)

* use socket file if passed in

* fixup

* cargo fmt

* Typing fixups

* Hide the --http-socket-file option on non-unix systems

Co-authored-by: Nadav Ivgi <nadav@shesek.info>

* Replace async-std::task -> tokio::task

* Replace tokio::task -> std::thread

* remove assert since it's an upsert

* Fix log typo (#27)

* Verify http-socket-file is a socket before deleting it

* Implement /asset/:asset/supply[/decimal] endpoints

* Don't deadlock when shutting down

Backported from upstream electrs:

- romanz@a3bfdda
- romanz@0f3aaa6

* Switch to `signal-hook` crate from deprecated `chan-signal`

Backported from upstream electrs: romanz@2286efb

* Fix bug introduced in the last commit

* Add additional elements-only fields to the UTXO endpoint

`nonce`, `surjection_proof` and `range_proof`

Refs Blockstream/esplora#217

* electrum: Ignore out-of-bounds block heights in block.headers

 As per the specs:
 > If the chain has not extended sufficiently far, only the available headers will be returned.

* electrum: Limit the number of returned headers

The `max` field indicated that a limit exists, but it was not enforced.

* Remove outdated Dockerfile

Refs Blockstream/esplora#45

* elements: Implement in-memory asset store and `GET /assets/registry`

* Use is_spendable() more consistently

* Add index-unspendables CLI flag (#28)

* http: Implement GET /block/:hash/header

* Add median time past to blocks json

* Make asset sorting case insensitive

The domain name doesn't need lower-casing because its
guaranteed to be in all lowercase.

* Fix get_fee_histogram

romanz@c88a0dc

* Fix ordering by asset ticker

* Fix get_block_header() in liquid mode

Liquid's BlockHeaders are not Copyable

* Return the total number of available registered assets

As the `X-Total-Results` header, in reply to `GET /assets/registry`

* Can derive Default

* Update crate dependencies

tokio and hyper were not upgraded because hyperlocal doesn't support
their latest versions.

* Don't add mempool transaction that already exists

Doing this doesn't affect the indexes, but may result in multiple
duplciated entries showing in the `recent` transactions.

* Properly handle negative balanaces in the Electrum RPC

Refs bitcoindevkit/rust-electrum-client#45

* Confirmed balances have to be positive

h/t @sgeisler bitcoindevkit/rust-electrum-client#45 (comment)

* Display warning message with just the number of transactions

The full list of txids can get pretty huge and is not really useful.

* Report the indexed tip height as a Prometheus metric (#37)

Co-authored-by: Nadav Ivgi <nadav@shesek.info>
Co-authored-by: Antoine Poinsot <darosior@protonmail.com>
Co-authored-by: Riccardo Casatta <riccardo@casatta.it>
Co-authored-by: GreenAddress <greenaddress@users.noreply.github.com>
Co-authored-by: Steven Zhao <steven@zhao.io>
Co-authored-by: Daniel Savu <savudani04@yahoo.ro>
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.

2 participants