Skip to content

Commit

Permalink
Merge pull request #269 from dashevo/improvement/p2shProposalSupport
Browse files Browse the repository at this point in the history
improvement: accept ps2h for proposals
  • Loading branch information
QuantumExplorer authored Sep 18, 2022
2 parents 1c00ff0 + 31eec10 commit 4bbb0ad
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 23 deletions.
8 changes: 0 additions & 8 deletions lib/errors/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ module.exports = [
name: 'invalidAddress',
message: 'Invalid Address',
},
{
name: 'invalidP2SHAddress',
message: 'Invalid P2SHAddress',
},
{
name: 'invalidPayment',
message: 'Invalid Payment Amount',
Expand Down Expand Up @@ -125,10 +121,6 @@ module.exports = [
name: 'invalidAddresses',
message: 'Invalid Payment Addresses',
},
{
name: 'invalidP2SHAddresses',
message: 'Invalid P2SH Payment Addresses',
},
{
name: 'invalidPaymentAmounts',
message: 'Invalid Payment Amounts',
Expand Down
5 changes: 0 additions & 5 deletions lib/govobject/types/proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ Proposal.prototype.getSerializationError = function (opts) {
return new errors.GovObject.Proposal.invalidAddress();
}

// verify not P2SH
if (this._verifyPayToScriptHash(this.payment_address, this.network)) {
return new errors.GovObject.Proposal.invalidP2SHAddress();
}

// verify payment amount (should be non-negative number)
if (this._verifyPayment(this.payment_amount)) {
return new errors.GovObject.Proposal.invalidPayment();
Expand Down
4 changes: 0 additions & 4 deletions lib/govobject/types/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ Trigger.prototype.getSerializationError = function (opts) {
if (!self._verifyAddress(addr, self.network)) {
return new errors.GovObject.Trigger.invalidAddresses();
}
// verify not P2SH
if (self._verifyPayToScriptHash(addr, self.network)) {
return new errors.GovObject.Trigger.invalidP2SHAddresses();
}
});

// verify payment amounts (should be non-negative number)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dashevo/dashcore-lib",
"version": "0.19.41",
"version": "0.19.42",
"description": "A pure and powerful JavaScript Dash library.",
"author": "Dash Core Group, Inc. <dev@dash.org>",
"main": "index.js",
Expand Down
6 changes: 3 additions & 3 deletions test/govobject/types/proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('Proposal', function () {
}).to.throw(errors.GovObject.Proposal.invalidAddress);
});

it('should throw error if payment address is P2SH', function () {
it('should not throw error if payment address is P2SH', function () {
var proposal = new Proposal();

proposal.network = 'testnet';
Expand All @@ -158,10 +158,10 @@ describe('Proposal', function () {

expect(function () {
return proposal.serialize();
}).to.throw(errors.GovObject.Proposal.invalidP2SHAddress);
}).to.not.throw();
expect(function () {
return proposal2.serialize();
}).to.throw(errors.GovObject.Proposal.invalidP2SHAddress);
}).to.not.throw();
});

it('should throw error if amount <= 0', function () {
Expand Down

0 comments on commit 4bbb0ad

Please sign in to comment.