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

Add additional payments integration tests #1135

Merged
merged 7 commits into from
Jul 23, 2018
Merged

Add additional payments integration tests #1135

merged 7 commits into from
Jul 23, 2018

Conversation

dcousens
Copy link
Contributor

No description provided.

@dcousens dcousens added this to the 4.0.0 milestone Jul 20, 2018
})
})

it.only('can (wrapped in P2WSH) broadcast as an output, and be spent as an input', (done) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something blows up on P2WSH(P2WPKH) ... is that a problematic combo?

})

it('can (wrapped in P2WSH) broadcast as an output, and be spent as an input', (done) => {
if (k === 'p2wpkh') return done() // skip P2WSH(P2WPKH)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is P2WSH(P2WPKH) possible?
Are we simply lacking support? (it fails)

})

it('can (wrapped in P2WSH, then wrapped in P2SH) broadcast as an output, and be spent as an input', (done) => {
if (k === 'p2wpkh') return done() // skip P2SH(P2WSH(P2WPKH))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, is P2SH(P2WSH(P2WPKH)) possible?
Are we simply lacking support? (it fails)

@dcousens
Copy link
Contributor Author

I'm happy to release after this passes

const p2wsh = bitcoin.payments.p2wsh({ redeem: { output }, network: NETWORK })
const p2sh = bitcoin.payments.p2sh({ redeem: { output: p2wsh.output }, network: NETWORK })

buildAndSign(depends, p2sh.output, p2sh.redeem.output, p2wsh.redeem.output, done)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that this works so simply... is awesome

@dcousens dcousens requested a review from junderw July 20, 2018 06:54
@dcousens
Copy link
Contributor Author

Waiting to see if P2WSH(P2WPKH) should be possible... if it is, I'll fix the tests, if it isn't, I'll enforce that TransactionBuilder refuses to sign it.

let signScript = witnessScript
if (expanded.type === SCRIPT_TYPES.P2WPKH) {
signScript = payments.p2pkh({ pubkey: expanded.pubkeys[0] }).output
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this would resolve the signing issues for P2WSH(P2WPKH)... but, it still fails. Investigating.

@dcousens
Copy link
Contributor Author

dcousens commented Jul 20, 2018

ok, @sipa has mentioned that P2WSH(P2WPKH) should fail (as we are experiencing), so, we need to prevent TransactionBuilder from even trying (or supporting users in their attempt!)

@dcousens
Copy link
Contributor Author

Any thoughts about whether we should try and block it via the payments scripts?
Can be done post 4.0.0 though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants