-
Notifications
You must be signed in to change notification settings - Fork 16
Final segwit poc #69
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
Open
julia-zack
wants to merge
25
commits into
master
Choose a base branch
from
final-segwit-poc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Final segwit poc #69
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e1095b5
Create new method createP2SHP2WSHOutputScript
marcos-iov cb9577c
Replace sha256hash160 with hash160. Refactor
julia-zack 11b9183
Use createP2SHOutputScript implementation that receives the script
marcos-iov e7fcfe7
Add test for function hash160
julia-zack 5bc92f6
Add createWitnessScript and needed constructor values into TxWitness …
julia-zack c304dcb
Merge pull request #62 from rsksmart/modify_TransactionWitness
marcos-iov b5369f1
Add hashForWitnessSignature, createWitnessErpScript and createP2shP2w…
julia-zack 1d15303
Update src/main/java/co/rsk/bitcoinj/core/TransactionWitness.java
marcos-iov 8045905
Merge pull request #63 from rsksmart/sign_with_witness_fed
marcos-iov 38ec8fa
Add witnessEmergencyScript, remove OP_0NOTEQUAL from redeem and refac…
julia-zack fcdb7c2
Correct OP_NOTIF argument
julia-zack c94b9e6
Merge pull request #64 from rsksmart/refactor_and_add_scripts
marcos-iov 25f6d80
Add function to create a flyover p2wsh script
marcos-iov a70f5ee
Merge pull request #66 from rsksmart/add_reedem_with_flyover
marcos-iov 2390c0b
Modify Wallet class to calculate fee for segwit
julia-zack 8e048ea
Add isSegwit parameter to SendRequest. Correct calculations in Wallet…
julia-zack 0e95d9e
Remove unnecessary code (prints and etc)
julia-zack c7f06dd
Add bytesToAdd to all txs totalSize
julia-zack 575c758
Add indentation
julia-zack 25f9abe
Add indentation
julia-zack b30262c
Merge pull request #68 from rsksmart/segwit_fee_calculation
julia-zack 0e2a246
Refactor. Modify size and fee calculation
julia-zack de55592
Modify size and fee calculation - FOR THE LAST TIME
julia-zack 13e4f3e
Refactor
julia-zack 696f2c7
Add comments. Rollback SIG_SIZE change
julia-zack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
28 changes: 28 additions & 0 deletions
28
src/main/java/co/rsk/bitcoinj/script/P2shP2wshErpFederationNewRedeemScriptParser.java
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package co.rsk.bitcoinj.script; | ||
|
||
import co.rsk.bitcoinj.core.Utils; | ||
|
||
public class P2shP2wshErpFederationNewRedeemScriptParser { | ||
public static Script createErpP2shP2wshNewRedeemScript( | ||
Script defaultFederationRedeemScript, | ||
Script erpFederationRedeemScript, | ||
Long csvValue) { | ||
|
||
byte[] serializedCsvValue = Utils.signedLongToByteArrayLE(csvValue); | ||
|
||
ScriptBuilder scriptBuilder = new ScriptBuilder(); | ||
|
||
Script erpRedeemScript = scriptBuilder | ||
.op(ScriptOpCodes.OP_NOTIF) | ||
.addChunks(defaultFederationRedeemScript.getChunks()) | ||
.op(ScriptOpCodes.OP_ELSE) | ||
.data(serializedCsvValue) | ||
.op(ScriptOpCodes.OP_CHECKSEQUENCEVERIFY) | ||
.op(ScriptOpCodes.OP_DROP) | ||
.addChunks(erpFederationRedeemScript.getChunks()) | ||
.op(ScriptOpCodes.OP_ENDIF) | ||
.build(); | ||
|
||
return erpRedeemScript; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/co/rsk/bitcoinj/script/P2shP2wshErpFederationRedeemScriptParser.java
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package co.rsk.bitcoinj.script; | ||
|
||
import co.rsk.bitcoinj.core.Sha256Hash; | ||
import co.rsk.bitcoinj.core.Utils; | ||
|
||
public class P2shP2wshErpFederationRedeemScriptParser { | ||
public static Script createP2shP2wshErpRedeemScript( | ||
Script defaultFederationRedeemScript, | ||
Script erpFederationRedeemScript, | ||
Long csvValue | ||
) { | ||
byte[] serializedCsvValue = Utils.signedLongToByteArrayLE(csvValue); | ||
|
||
ScriptBuilder scriptBuilder = new ScriptBuilder(); | ||
|
||
Script erpP2shP2wshRedeemScript = scriptBuilder | ||
.op(ScriptOpCodes.OP_NOTIF) | ||
.addChunks(defaultFederationRedeemScript.getChunks()) | ||
.op(ScriptOpCodes.OP_ELSE) | ||
.data(serializedCsvValue) | ||
.op(ScriptOpCodes.OP_CHECKSEQUENCEVERIFY) | ||
.op(ScriptOpCodes.OP_DROP) | ||
.addChunks(erpFederationRedeemScript.getChunks()) | ||
.op(ScriptOpCodes.OP_ENDIF) | ||
.build(); | ||
return erpP2shP2wshRedeemScript; | ||
} | ||
|
||
public static Script createP2shP2wshErpRedeemScriptWithFlyover( | ||
Script defaultFederationRedeemScript, | ||
Script erpFederationRedeemScript, | ||
Sha256Hash derivationPath, | ||
Long csvValue | ||
) { | ||
byte[] serializedCsvValue = Utils.signedLongToByteArrayLE(csvValue); | ||
|
||
ScriptBuilder scriptBuilder = new ScriptBuilder(); | ||
|
||
Script erpP2shP2wshRedeemScript = scriptBuilder | ||
.data(derivationPath.getBytes()) | ||
.op(ScriptOpCodes.OP_DROP) | ||
.op(ScriptOpCodes.OP_NOTIF) | ||
.addChunks(defaultFederationRedeemScript.getChunks()) | ||
.op(ScriptOpCodes.OP_ELSE) | ||
.data(serializedCsvValue) | ||
.op(ScriptOpCodes.OP_CHECKSEQUENCEVERIFY) | ||
.op(ScriptOpCodes.OP_DROP) | ||
.addChunks(erpFederationRedeemScript.getChunks()) | ||
.op(ScriptOpCodes.OP_ENDIF) | ||
.build(); | ||
|
||
return erpP2shP2wshRedeemScript; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.