Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Segwit Support #49

Merged
merged 30 commits into from
Sep 28, 2018
Merged

Segwit Support #49

merged 30 commits into from
Sep 28, 2018

Conversation

hewigovens
Copy link
Contributor

@hewigovens hewigovens commented Sep 10, 2018

Script\Type P2PK P2PKH P2WPKH P2SH P2WPKH P2WSH P2SH P2WSH
redeem
lock N/A N/A

@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

Merging #49 into master will increase coverage by 2.41%.
The diff coverage is 72.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
+ Coverage   81.77%   84.18%   +2.41%     
==========================================
  Files          77       79       +2     
  Lines        3117     2846     -271     
==========================================
- Hits         2549     2396     -153     
+ Misses        568      450     -118
Impacted Files Coverage Δ
Tests/PurposeTests.swift 100% <ø> (ø) ⬆️
Sources/BinaryCoding.swift 22.64% <0%> (-11.19%) ⬇️
Sources/Bitcoin/BitcoinScript+Parsing.swift 0% <0%> (ø)
Tests/Bitcoin/BitcoinAddressTests.swift 100% <100%> (ø) ⬆️
Tests/Bitcoin/BitcoinSignerTests.swift 100% <100%> (ø) ⬆️
Sources/Bitcoin/BitcoinTransaction.swift 76.56% <33.33%> (+5.97%) ⬆️
Sources/Bitcoin/BitcoinScript.swift 44.64% <50%> (+31.26%) ⬆️
Sources/Bitcoin/BitcoinTransactionSigner.swift 72.22% <71.42%> (-16.67%) ⬇️
Sources/Bitcoin/BitcoinPrivateKeyProvider.swift 83.33% <83.33%> (ø)
Sources/Bitcoin/BitcoinTransaction+Signing.swift 94.2% <92.3%> (-0.88%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae9b5e8...736eb8e. Read the comment docs.

let publicKey = PublicKey(data: Data(hexString: "042de45bea3dada528eee8a1e04142d3e04fad66119d971b6019b0e3c02266b79142158aa83469db1332a880a2d5f8ce0b3bba542b3e32df0740ccbfb01c275e42")!)!
XCTAssertEqual(publicKey.bitcoinAddress(prefix: 0x05).description, "3LbBftXPhBmByAqgpZqx61ttiFfxjde2z7")
let address = publicKey.bitcoinAddress(prefix: 0x05)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we do 0x05 => Bitcoin().payToScriptHashAddressPrefix?

@hewigovens hewigovens changed the title [WIP] unlock script hash utxo [WIP] P2SH / P2SH-P2WPKH Support Sep 12, 2018
@hewigovens hewigovens changed the title [WIP] P2SH / P2SH-P2WPKH Support [WIP] Segwit Support Sep 23, 2018
@alejandro-isaza alejandro-isaza changed the title [WIP] Segwit Support Segwit Support Sep 28, 2018
@hewigovens
Copy link
Contributor Author

compiling on 32bit devices failed:

Testing failed:
	Cannot convert value of type '(UnsafeRawBufferPointer) -> Data' to expected argument type '(UnsafeRawBufferPointer) -> _'
	Cannot convert value of type '(UnsafeRawBufferPointer) -> Data' to expected argument type '(UnsafeRawBufferPointer) -> _'
** TEST FAILED **
The following build commands failed:
	CompileSwift normal i386 /Users/travis/build/TrustWallet/trust-core/Sources/Bitcoin/BitcoinTransactionSigner.swift
	CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler
(2 failures)
The command "xcodebuild clean test -workspace TrustCore.xcworkspace -scheme "TrustCore" -destination 'platform=iOS Simulator,name=iPhone 5'" exited with 65.

@@ -223,7 +223,7 @@ public final class BitcoinScript: BinaryEncoding, CustomDebugStringConvertible {
var data = Data(capacity: 5 + pubKeyHash.count)
data.append(contentsOf: [OpCode.OP_DUP, OpCode.OP_HASH160])
data.append(UInt8(pubKeyHash.count))
data.append(pubKeyHash)
data.append([UInt8](pubKeyHash), count: pubKeyHash.count)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why this fixes anything 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Swift mystery.

Remember we had similar bug? Data wasn’t converted properly

Copy link
Contributor

Choose a reason for hiding this comment

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

Right

@vikmeup vikmeup merged commit bcf7e4e into master Sep 28, 2018
@vikmeup vikmeup deleted the unlock-p2sh branch September 28, 2018 22:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants