-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from bloom-solutions/batch_calls
Use batch calls for btc to ease up bitcoind
- Loading branch information
Showing
27 changed files
with
1,629 additions
and
193 deletions.
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
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Btc | ||
class GetBlocksHashes | ||
|
||
extend LightService::Action | ||
expects :bitcoiner_client, :unsynced_blocks | ||
promises :block_hashes | ||
|
||
executed do |c| | ||
args = c.unsynced_blocks.map do |block_height| | ||
["getblockhash", [block_height]] | ||
end | ||
|
||
response = c.bitcoiner_client.request(args) | ||
|
||
c.block_hashes = response.map { |hash| hash["result"] } | ||
end | ||
|
||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Btc | ||
class GetRemoteBlocks | ||
|
||
extend LightService::Action | ||
expects :bitcoiner_client, :block_hashes | ||
promises :remote_blocks | ||
VERBOSITY = 2 | ||
|
||
executed do |c| | ||
args = c.block_hashes.map do |block_hash| | ||
["getblock", [block_hash, VERBOSITY]] | ||
end | ||
|
||
response = c.bitcoiner_client.request(args) | ||
|
||
c.remote_blocks = response.map { |hash| hash["result"] } | ||
end | ||
|
||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Btc | ||
module GetRemoteBlocksTxs | ||
|
||
extend LightService::Action | ||
expects :bitcoiner_client, :remote_blocks | ||
promises :remote_txs | ||
|
||
executed do |c| | ||
c.remote_txs = c.remote_blocks.map do |remote_block| | ||
remote_block["tx"] || [] | ||
end.flatten | ||
end | ||
|
||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module Btc | ||
class GetRemoteTxsFromTxIds | ||
|
||
extend LightService::Action | ||
expects :bitcoiner_client, :tx_ids | ||
promises :remote_txs | ||
VERBOSE = true | ||
|
||
executed do |c| | ||
args = c.tx_ids.map { |tx_id| ["getrawtransaction", [tx_id, VERBOSE]] } | ||
response = c.bitcoiner_client.request(args) | ||
c.remote_txs = response.map { |r| r["result"] } | ||
end | ||
|
||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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
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.