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

refactor(crypto): move mainnet exceptions #2529

Merged
merged 1 commit into from
May 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions packages/crypto/src/blocks/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ export class Block implements IBlock {

this.verification = this.verify();

// order of transactions messed up in mainnet V1
// TODO: move this to network constants exception using block ids
if (
this.transactions &&
this.data.numberOfTransactions === 2 &&
(this.data.height === 3084276 || this.data.height === 34420)
) {
const temp = this.transactions[0];
this.transactions[0] = this.transactions[1];
this.transactions[1] = temp;
// Order of transactions messed up in mainnet V1
const { wrongTransactionOrder } = configManager.get("exceptions");
if (wrongTransactionOrder && wrongTransactionOrder[this.data.id]) {
const fixedOrderIds = wrongTransactionOrder[this.data.id];

this.transactions = fixedOrderIds.map((id: string) =>
this.transactions.find(transaction => transaction.id === id),
);
}
}

Expand Down
14 changes: 10 additions & 4 deletions packages/crypto/src/networks/mainnet/exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
"transactions": [
"608c7aeba0895da4517496590896eb325a0b5d367e1b186b1c07d7651a568b9e",
"43223de192d61a341301cc831a325ffe21d3e99666c023749bd4b562652f6796",

"2d8ed494d852880eb674c279fad64468bfccadd79d2a63cc69a5ca80116933f5",
"31de62ecd08b12b897d0ab50fb8cb07cff149b8cee7116c17ccb8b3916e2eeb7",
"12be521f2bafb28cc7ada7139d424eaf0e68f7ac20216b5840d68509badebbe8",
"cbd6862966bb1b03ba742397b7e5a88d6eefb393a362ead0d605723b840db2af",

"e54fdacca38409781abdfd273d9ab11bf04c65286311b9c17d2f73829408b561",
"38ef7225c653e9aa9e78434a30403c379318bbde514ccb7f32aff72c067043e6",
"67f9eacdde5e4f8c90f430ea6bca0972984e50d3fc404c0d85c59a2aeecacda7",
Expand Down Expand Up @@ -42,12 +40,10 @@
"500e035ff064f19599d41e98c2725687fb8736367f85080517dbc91bc9d2f25e",
"67456af6f26a14f6f6209fee5e9b65ec517ee6f8035853d26ef4d0196eca369a",
"c9f9fa471a19515e6b57ba4c22c434044041a39ebffca7b10cde8483d1f8e716",

"4f83bc708288044a6f5f2773b90e1456af2ddc50ed8f3b63e960f5f16cac7d73",
"2c0f79b3689cb1a065aec5494070a165b1183e93aac9f8be6d6c393d71d04979",
"fe3015fefe5b9d6b023c922c00264c92af07635374865cd25f7a4b91188d5c47",
"65aa2caf22785619d1a0f53f2dd56baba47fb02a702ee330161a89c0f148b7b2",

"743ba3234f1c74dd187595a25ff53184e12e5561cb6d28dba4e470552cbdb602",
"4f3e18c955c94cb1d3aa977e4dcfe9574555d361ab687e9624bfa2b7ee15b4b9",
"748e5295ba2378cb29d92c2b0c6160ebd07ddefa7ce136f93fc9f83e3e430c09",
Expand Down Expand Up @@ -93,5 +89,15 @@
},
"transactionIdFixTable": {
"ca764c01dd78f93393b02f7f6c4f0c12ed8e7ca26d3098e91d6e461a238a6b33": "80d75c7b90288246199e4a97ba726bad6639595ef92ad7c2bd14fd31563241ab"
},
"wrongTransactionOrder": {
"11773170219525190460": [
"7a1a43098cd253db395514220f69e3b99afaabb2bfcf5ecfa3b99727b367344b",
"bace38ea544678f951cdd4abc269be24b4f5bab925ff6d5b480657952eb5aa65"
],
"5847703302374058501": [
"ce3b901c5507993a282c36987cbf003769e962d721b70a9f550b9ac1654fcee7",
"163c355844ced31ea62c86aeba033a1ba75f8a9657729990e17b06cbdf31f68a"
]
}
}