-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NOD-289] Implement API-Server bootstrapping and booting after downti…
…me (#408) * [NOD-289] Implemented database isCurrent checking and connection. * [NOD-289] Added GetChainFromBlock to RPCClient. * [NOD-289] Limited the amount of blocks in GetChainFromBlockResponse. * [NOD-289] Fixed various issues that were keeping GetChainFromBlocks from working properly. * [NOD-289] Created blockloop.go. * [NOD-289] Updated go.mod after merge. * [NOD-289] Implemented collection of current selected parent chain. * [NOD-289] Fixed test. Reverted not deleting utxoDiffData from the DB. * [NOD-289] Implemented GetBlocks. * [NOD-289] Added comment to BlockHashesFrom. * [NOD-289] Added GetBlocks to rpcclient. * [NOD-289] Added verboseBlocks to GetBlocks. * [NOD-289] Implemented block insertion. * [NOD-289] Added AUTO_INCREMENT to tables that were missing it. * [NOD-289] Made gasLimit in subnetwork nullable. * [NOD-289] Renamed transactions_outputs to transaction_outputs. * [NOD-289] Fixed weird coinbase behavior in vin. * [NOD-289] Made collectCurrentBlocks start from the most recent startHash. * [NOD-289] Added IsChainBlock to GetBlockVerboseResult. * [NOD-289] Implemented adding a block from onBlockAdded. * [NOD-289] Added removedParentChainHashes to getChainFromBlock. * [NOD-289] Implemented updating the selected parent chain from onChainChanged. * [NOD-289] Implemented some initial logic for updating the UTXO. * [NOD-289] Fixed merge errors. * [NOD-326] Fixed some more merge errors. * [NOD-289] Added error handling for missing required records. * [NOD-289] Implemented handling removedChainHashes. * [NOD-289] Implemented handling addedChainBlocks. * [NOD-289] Fixed incorrect coinbase check. * [NOD-289] Implemented inserting the transaction output address. * [NOD-289] Added updating block.IsChainBlock. * [NOD-289] Split insertBlock into many small functions. * [NOD-289] Split updateSelectedParentChain into smaller functions. * [NOD-289] Fixed pointer errors. * [NOD-289] Fixed a bad exists check. * [NOD-289] Fixed a couple of small bugs. * [NOD-289] Fixed a TxID/Hash mixup. * [NOD-289] Added block/tx mass to getBlockVerboseResponse. * [NOD-289] Renamed blockLoop.go to sync.go. Added comments. * [NOD-289] Deleted apiserver README. * [NOD-289] Fixed golint errors. * [NOD-289] Renamed findMostRecentBlockHash to findHashOfBluestBlock. * [NOD-289] Fixed style in syncBlocks and fixed a comment. * [NOD-289] Copied NewErrorFromDBErrors over from NOD-324. * [NOD-289] Created a couple of utils to make error handling with gorm slightly less painful. * [NOD-289] Added error handling for database calls. * [NOD-289] Fixed some more style/comments. * [NOD-289] Fixed comments. * [NOD-289] Renamed TransactionInput.TransactionOutput to TransactionInput.PreviousTransactionOutput. * [NOD-289] Added a commends about pagination in getBlocks and getChainFromBlock. * [NOD-289] Removed the coinbase field from Vin. * [NOD-289] Deferred handling chainChangedMsgs until we have the appropriate data. * [NOD-289] Optimized queries in updateRemovedChainHashes and updateAddedChainBlocks. * [NOD-289] Optimized queries in insertBlockParents. * [NOD-289] Optimized queries in insertTransactionInput. * [NOD-289] Split Where calls to separate lines. * [NOD-289] Fixed merge errors. * [NOD-289] Exited early from insertBlockParents if we're the genesis block. * [NOD-289] Improved nextChainChangedChan mechanism. * [NOD-289] Fixed the above sync mechanism a bit. * [NOD-289] Renamed IsDBRecordNotFoundError to HasDBRecordNotFoundError and IsDBError to HasDBError. * [NOD-289] Replaced old error handling for db errors with the lovely new stuff. * [NOD-289] Exited early if we already inserted a block. This saves us checking if a record already exists for some record types. * [NOD-289] Decoupled syncBlocks from syncSelectedParentChain. * [NOD-289] Made a comment more explicit. * [NOD-289] Extracted net resolution to a separate function. * [NOD-289] Extracted syncing to a separate function. * [NOD-289] Fixed a comment. * [NOD-289] Fixed merge erros. * [NOD-289] Fixed a couple of bugs. * [NOD-289] Fixed another bug. * [NOD-289] Extracted ChainChangedMsg conversion to a separate function. * [NOD-289] Optimized queries in canHandleChainChangedMsg. * [NOD-289] Moved the sync function closer to its call site. * [NOD-289] Renamed HasDBRecordNotFoundError to IsDBRecordNotFoundError. * [NOD-289] Used count instead of first. * [NOD-289] Renamed address to hexAddress.
- Loading branch information
1 parent
7371120
commit adf4b43
Showing
25 changed files
with
1,407 additions
and
149 deletions.
There are no files selected for viewing
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
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 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 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
CREATE TABLE `subnetworks` | ||
( | ||
`id` BIGINT UNSIGNED NOT NULL, | ||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`subnetwork_id` CHAR(64) NOT NULL, | ||
`gas_limit` BIGINT UNSIGNED NOT NULL, | ||
`gas_limit` BIGINT UNSIGNED NULL, | ||
PRIMARY KEY (`id`), | ||
UNIQUE INDEX `idx_subnetworks_subnetwork_id` (`subnetwork_id`) | ||
); |
18 changes: 9 additions & 9 deletions
18
apiserver/migrations/000009_create_transaction_inputs_table.up.sql
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
CREATE TABLE `transaction_inputs` | ||
( | ||
`id` BIGINT UNSIGNED NOT NULL, | ||
`transaction_id` BIGINT UNSIGNED NULL, | ||
`transaction_output_id` BIGINT UNSIGNED NOT NULL, | ||
`index` INT UNSIGNED NOT NULL, | ||
`signature_script` BLOB NOT NULL, | ||
`sequence` BIGINT UNSIGNED NOT NULL, | ||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`transaction_id` BIGINT UNSIGNED NULL, | ||
`previous_transaction_output_id` BIGINT UNSIGNED NOT NULL, | ||
`index` INT UNSIGNED NOT NULL, | ||
`signature_script` BLOB NOT NULL, | ||
`sequence` BIGINT UNSIGNED NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `idx_transaction_inputs_transaction_id` (`transaction_id`), | ||
INDEX `idx_transaction_inputs_transaction_output_id` (`transaction_output_id`), | ||
INDEX `idx_transaction_inputs_previous_transaction_output_id` (`previous_transaction_output_id`), | ||
CONSTRAINT `fk_transaction_inputs_transaction_id` | ||
FOREIGN KEY (`transaction_id`) | ||
REFERENCES `transactions` (`id`), | ||
CONSTRAINT `fk_transaction_inputs_transaction_output_id` | ||
FOREIGN KEY (`transaction_output_id`) | ||
CONSTRAINT `fk_transaction_inputs_previous_transaction_output_id` | ||
FOREIGN KEY (`previous_transaction_output_id`) | ||
REFERENCES `transaction_outputs` (`id`) | ||
); |
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.