-
Notifications
You must be signed in to change notification settings - Fork 24
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
Replace Insight with Bitcoin Core in BlockchainWriter #408
Conversation
|
||
if (!utxo || !utxo.length) | ||
throw new Error(`Wallet seems to be empty. Check funds for ${this.configuration.bitcoinAddress}`) | ||
private anchorData = async (data: string) => { |
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.
I experimented with pipeP
for this but decided not to use it yet.
I've left the experiments in another branch.
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.
Agreed, it probably requires to much refactoring to use it nicely atm.
@@ -0,0 +1,2 @@ | |||
export const getData = (prefix: string, version: ReadonlyArray<number>) => (message: string) => |
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.
Can/Should this be unit tested?
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.
Yes. Will add in other PR
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.
- Tested changes manually
- Checked accidental architectural/style changes
- Reviewed entire diff
- Unit tests
- Documentation
- Filenames and locations
Missing 1 unit test possibly above src/BlockchainWriter/Bitcoind.ts
I was unable to manually test, I was getting Insufficient Funds when trying to use regtest mode to manually test transactions.
Could use some documentation on adding funds to the regest docker container and anything else that needs to be done with regtest to successfully read/write.
Remaining code changes look good. Il will take a second look soon to make sure I didn't miss anything.
Will add proper docs in a new PR. For now: in regtest, |
docker-compose.yml
Outdated
@@ -41,21 +41,30 @@ services: | |||
sleep 10; | |||
npm start; | |||
" | |||
poet-bitcoind: | |||
bitcoin-testnet: |
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.
I don't see the need to stand up a testnet docker instance anymore now that we are using regtest. If that is correct, can we either comment this out or remove it? Otherwise when I run docker up --build
I am starting up a testnet instance and syncing with the testnet blockchain, thus using up bandwidth and storage for no real reason.
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.
Good point @geoffturk. I can't think of a situation that I would still want a testnet docker instance locally.
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.
Actually, now that I thought about it more, I think we do want a mainnet/testnet instance actually for people to run the node on their machines. Maybe we just need a simpler way of expressing which instance we run instead of running all of them, but that can be tackled in a future PR.
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.
That's correct, I'll split it apart in different docker-compose files. We still want to test stuff in testnet if possible, but docker up
shouldn't cause you to download the whole testnet.
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.
- Tested changes manually
- Checked accidental architectural/style changes
- Reviewed entire diff
- Unit tests
- Filenames and locations
N/A
- Documentation
Just succesfully manual tested 2 claims from write to read! Just the unit test.
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.
Approving so you can add the unit tests then merge tonight hopefully.
docker-compose.yml
Outdated
@@ -36,27 +36,20 @@ services: | |||
- poet-mongo | |||
- poet-rabbit | |||
- poet-ipfs | |||
- bitcoin |
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.
should this be bitcoin-regtest?
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.
yes! good catch.
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.
fixed!
@kennylavender @geoffturk @jwicks31 merging now not to block other PRs. I think I've addressed your reviews, but please reach out / raise issues if there's changes you think should be done to this PR. |
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
PR Process - PR Review Checklist
Fixes #24
Fixes #93
Partly addresses #293
needed-by #22
needed-by #25
needed-by #27
Release
Semantic release is enabled for this repository. Make sure you follow the right commit message convention.
We're using semantic-release's default — Angular Commit Message Conventions.
Description of Changes
This PR replaces the Insight API dependency of the BlockchainWriter module with the Bitcoin Core Wallet, finishing the migration.
Docker Compose
Dependencies
bitcore-lib
and@types/bitcore-lib
were uninstalled.Deleted Tests
Placeholder tests that were introduced to bypass an error in coverage were deleted.
Rename
This PR started replacing
timestamp
withanchor
. See #293.Configuration
insightUrl
,bitcoinAddress
andbitcoinAddressPrivateKey
were removed.Fee Estimation
The previous could would always send a fee of
0.001
. This new code is using thefundrawtransaction
RPC, which estimates fees based on recent blocks.How to Test
This is how I tested this change:
sudo docker-compose up -d bitcoin-regtest
db.dropDatabase()
npm run build
npm start
npm run test:integration
GET http://localhost:18080/works
timestamp.ipfsFileHash
,timestamp.ipfsDirectoryHash
andtransactionId
. These three properties will appear one by one. Keep refreshing until the show.bitcoin-cli generate 1
GET http://localhost:18080/works
againtimestamp
, withblockHash
,blockHeight
, etc.I ran this test both in regtest and testnet.
One ideal test I haven't done is node syncing: deploy this code and the dependencies to two different machines and confirm they sync correctly.
Things Being Left Out
I'm leaving out of this PR a few things since it's actually working as it is and it's blocking several other PRs.