diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 122835bdfc..b5ee09af3d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,8 +19,8 @@ env: GO111MODULE: on GO_VERSION: 1.19.x - BITCOIND_VERSION: '22.0' - BITCOIND_IMAGE: 'lightninglabs/bitcoin-core' + BITCOIND_VERSION: "0.21.4" + BITCOIND_IMAGE: "litecoinproject/litecoin-core" jobs: ######################## @@ -36,7 +36,7 @@ jobs: - name: setup go ${{ env.GO_VERSION }} uses: actions/setup-go@v2 with: - go-version: '${{ env.GO_VERSION }}' + go-version: "${{ env.GO_VERSION }}" - name: run format run: make fmt @@ -61,11 +61,11 @@ jobs: - unit-race - unit-cover steps: - - name: extract bitcoind from docker image + - name: extract litecoind from docker image run: |- docker pull ${{ env.BITCOIND_IMAGE }}:${{ env.BITCOIND_VERSION }} CONTAINER_ID=$(docker create ${{ env.BITCOIND_IMAGE }}:${{ env.BITCOIND_VERSION }}) - sudo docker cp $CONTAINER_ID:/opt/bitcoin-${{ env.BITCOIND_VERSION }}/bin/bitcoind /usr/local/bin/bitcoind + sudo docker cp $CONTAINER_ID:/opt/litecoin-${{ env.BITCOIND_VERSION }}/bin/litecoind /usr/local/bin/litecoind docker rm $CONTAINER_ID - name: git checkout @@ -85,7 +85,7 @@ jobs: - name: setup go ${{ env.GO_VERSION }} uses: actions/setup-go@v2 with: - go-version: '${{ env.GO_VERSION }}' + go-version: "${{ env.GO_VERSION }}" - name: run ${{ matrix.unit_type }} run: make ${{ matrix.unit_type }} diff --git a/waddrmgr/manager_test.go b/waddrmgr/manager_test.go index 47f95bc0c4..defe44a50f 100644 --- a/waddrmgr/manager_test.go +++ b/waddrmgr/manager_test.go @@ -3067,7 +3067,7 @@ func TestTaprootPubKeyDerivation(t *testing.T) { t, db, func(ns walletdb.ReadWriteBucket) (ManagedAddress, error) { return scopedMgr.DeriveFromKeyPath(ns, externalPath) }, - "ltc1puht8rk95c53q3u9w3pf9h3jfcutcrl9lxc7rqsdthjrse4k6sn7q9tuqm9", + "ltc1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxq4arnzx", scopedMgr, ) assertAddressDerivation( @@ -3078,21 +3078,21 @@ func TestTaprootPubKeyDerivation(t *testing.T) { } return addrs[0], nil }, - "ltc1puht8rk95c53q3u9w3pf9h3jfcutcrl9lxc7rqsdthjrse4k6sn7q9tuqm9", + "ltc1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxq4arnzx", scopedMgr, ) assertAddressDerivation( t, db, func(ns walletdb.ReadWriteBucket) (ManagedAddress, error) { return scopedMgr.LastExternalAddress(ns, 0) }, - "ltc1puht8rk95c53q3u9w3pf9h3jfcutcrl9lxc7rqsdthjrse4k6sn7q9tuqm9", + "ltc1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxq4arnzx", scopedMgr, ) assertAddressDerivation( t, db, func(ns walletdb.ReadWriteBucket) (ManagedAddress, error) { return scopedMgr.DeriveFromKeyPath(ns, internalPath) }, - "ltc1pehskafcqerg3hqvx005ywevqta7r0q980xgnencjgez0fyf7lt7s8r36hx", + "ltc1p3qkhfews2uk44qtvauqyr2ttdsw7svhkl9nkm9s9c3x4ax5h60wqd8j8vm", scopedMgr, ) assertAddressDerivation( @@ -3103,14 +3103,14 @@ func TestTaprootPubKeyDerivation(t *testing.T) { } return addrs[0], nil }, - "ltc1pehskafcqerg3hqvx005ywevqta7r0q980xgnencjgez0fyf7lt7s8r36hx", + "ltc1p3qkhfews2uk44qtvauqyr2ttdsw7svhkl9nkm9s9c3x4ax5h60wqd8j8vm", scopedMgr, ) assertAddressDerivation( t, db, func(ns walletdb.ReadWriteBucket) (ManagedAddress, error) { return scopedMgr.LastInternalAddress(ns, 0) }, - "ltc1pehskafcqerg3hqvx005ywevqta7r0q980xgnencjgez0fyf7lt7s8r36hx", + "ltc1p3qkhfews2uk44qtvauqyr2ttdsw7svhkl9nkm9s9c3x4ax5h60wqd8j8vm", scopedMgr, ) } diff --git a/wallet/psbt_test.go b/wallet/psbt_test.go index e471978e0d..b34dc450e3 100644 --- a/wallet/psbt_test.go +++ b/wallet/psbt_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/require" "github.com/ltcsuite/ltcd/ltcutil" + "github.com/ltcsuite/ltcd/ltcutil/mweb" "github.com/ltcsuite/ltcd/ltcutil/psbt" "github.com/ltcsuite/ltcd/txscript" "github.com/ltcsuite/ltcd/wire" @@ -342,7 +343,6 @@ func TestFundPsbt(t *testing.T) { // The third item should be the branch and should belong // to a change output. require.EqualValues(t, 1, b32d.Bip32Path[3]) - assertChangeOutputScope( t, changeTxOut.PkScript, tc.changeKeyScope, ) @@ -402,7 +402,11 @@ func assertChangeOutputScope(t *testing.T, pkScript []byte, // By default (changeScope == nil), the script should // be a pay-to-taproot one. switch changeScope { - case nil, &waddrmgr.KeyScopeBIP0086: + // LITECOIN: default change goes to witness pk + case nil: + require.True(t, txscript.IsPayToWitnessPubKeyHash(pkScript)) + + case &waddrmgr.KeyScopeBIP0086: require.True(t, txscript.IsPayToTaproot(pkScript)) case &waddrmgr.KeyScopeBIP0049Plus, &waddrmgr.KeyScopeBIP0084: @@ -498,8 +502,10 @@ func TestFinalizePsbt(t *testing.T) { Outputs: []psbt.POutput{{}, {}, {}}, } + var mwebKeychain *mweb.Keychain + // Finalize it to add all witness data then extract the final TX. - err = w.FinalizePsbt(nil, 0, packet) + err = w.FinalizePsbt(nil, 0, mwebKeychain, packet) if err != nil { t.Fatalf("error finalizing PSBT packet: %v", err) }