Skip to content
Open
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
35 changes: 35 additions & 0 deletions lib/blockchain/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const CoinView = require('../coins/coinview');
const Script = require('../script/script');
const {VerifyError} = require('../protocol/errors');
const {OwnershipProof} = require('../covenants/ownership');
const Address = require('../primitives/address');
const AirdropProof = require('../primitives/airdropproof');
const {CriticalError} = require('../errors');
const thresholdStates = common.thresholdStates;
Expand Down Expand Up @@ -918,13 +919,47 @@ class Chain extends AsyncEmitter {
// Make sure the miner isn't trying to conjure more coins.
reward += consensus.getReward(height, interval);

// Add reallocation amount at hard fork height.
if (height === this.network.reallocationHeight
&& consensus.AIRDROP_REALLOCATION > 0) {
reward += consensus.AIRDROP_REALLOCATION;
}

if (block.getClaimed() > reward) {
throw new VerifyError(block,
'invalid',
'bad-cb-amount',
0);
}

// Validate reallocation output at hard fork height.
if (height === this.network.reallocationHeight
&& this.network.reallocationAddress
&& consensus.AIRDROP_REALLOCATION > 0) {
const cb = block.txs[0];
const addr = Address.fromString(
this.network.reallocationAddress,
this.network
);

let found = false;

for (const output of cb.outputs) {
if (output.value === consensus.AIRDROP_REALLOCATION
&& output.address.equals(addr)) {
found = true;
break;
}
}

if (!found) {
throw new VerifyError(block,
'invalid',
'bad-cb-reallocation',
100);
}
}

// Push onto verification queue.
const jobs = [];
for (let i = 0; i < block.txs.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion lib/covenants/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ rules.MAX_NAME_SIZE = 63;
* @default
*/

rules.MAX_RESOURCE_SIZE = 512;
rules.MAX_RESOURCE_SIZE = 8192;

/**
* Consensus name verification flags (used for block validation).
Expand Down
48 changes: 40 additions & 8 deletions lib/dns/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,33 @@ exports.TYPE_MAP_NS = Buffer.from('0006200000000003', 'hex');
// TXT RRSIG NSEC
exports.TYPE_MAP_TXT = Buffer.from('0006000080000003', 'hex');

// A RRSIG NSEC
exports.TYPE_MAP_A = Buffer.from('0006400000000003', 'hex');

// AAAA RRSIG NSEC
exports.TYPE_MAP_AAAA = Buffer.from('0006000000080003', 'hex');

exports.hsTypes = {
DS: 0,
NS: 1,
GLUE4: 2,
GLUE6: 3,
SYNTH4: 4,
SYNTH6: 5,
TXT: 6
TXT: 6,
A: 7,
AAAA: 8,
CNAME: 9,
DNAME: 10,
MX: 11,
SRV: 12,
TLSA: 13,
SSHFP: 14,
CAA: 15,
SOA: 16,
PTR: 17,
NAPTR: 18,
SMIMEA: 19,
OPENPGPKEY: 20,
URI: 21,
LOC: 22,
RP: 23,
LABEL: 24,
RAW: 25
};

exports.hsTypesByVal = {
Expand All @@ -52,5 +65,24 @@ exports.hsTypesByVal = {
[exports.hsTypes.GLUE6]: 'GLUE6',
[exports.hsTypes.SYNTH4]: 'SYNTH4',
[exports.hsTypes.SYNTH6]: 'SYNTH6',
[exports.hsTypes.TXT]: 'TXT'
[exports.hsTypes.TXT]: 'TXT',
[exports.hsTypes.A]: 'A',
[exports.hsTypes.AAAA]: 'AAAA',
[exports.hsTypes.CNAME]: 'CNAME',
[exports.hsTypes.DNAME]: 'DNAME',
[exports.hsTypes.MX]: 'MX',
[exports.hsTypes.SRV]: 'SRV',
[exports.hsTypes.TLSA]: 'TLSA',
[exports.hsTypes.SSHFP]: 'SSHFP',
[exports.hsTypes.CAA]: 'CAA',
[exports.hsTypes.SOA]: 'SOA',
[exports.hsTypes.PTR]: 'PTR',
[exports.hsTypes.NAPTR]: 'NAPTR',
[exports.hsTypes.SMIMEA]: 'SMIMEA',
[exports.hsTypes.OPENPGPKEY]: 'OPENPGPKEY',
[exports.hsTypes.URI]: 'URI',
[exports.hsTypes.LOC]: 'LOC',
[exports.hsTypes.RP]: 'RP',
[exports.hsTypes.LABEL]: 'LABEL',
[exports.hsTypes.RAW]: 'RAW'
};
Loading
Loading