gagliardetto / solana-go

Go SDK library and RPC client for the Solana Blockchain
Apache License 2.0
930 stars 264 forks source link

TransactionWithMeta.GetTransaction() errors #115

Closed parihaaraka closed 1 year ago

parihaaraka commented 2 years ago

v1.6.0

    maxSupportedTransactionVersion := uint64(0)
    block, err := c.altConnection.GetBlockWithOpts(
        ctx,
        blockNumber,
        &rpc.GetBlockOpts{
            MaxSupportedTransactionVersion: &maxSupportedTransactionVersion,
        },
    )
    ...
    for _, tx := range block.Transactions {
        txx, err := tx.GetTransaction()
        // massive errors here:
        // "required [1] byte, remaining [0]"
        //  or
        // "not enough data: 15277 bytes missing"
        //     tx.Transaction.GetBinary() = 019bc27ede358de228333da803f05796fbf2b40a036a522291b9954d521522d754487c177df3eb1e3db8fc081beb91ec507f2bc09e36cf111bda67e5b2a830aa028001000206aef48cae41a552bfc14a4a7ea3b5b654e4a1a25ea3c59808f874080c70bd5bcb1594b088b7df9e4b3c7d0f3c2fde952e1b77f2f1eb92103e5bf605510dab0fe79dd44de9b53188e0fc15cd8acda66146d3799bdcf292e6f001e922dcfdf5250a4a1785eb82b18aa61216e662d216c753abcc8d36512264b8d542bc2d5f5efabc0306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a400000001dfb9f614e8fb17ccfe176ffb08473bd38de2082a29cc9ae2f1fc70af0070ad3c487b8eeea3125c692c35ec96b5ebc7deca9b41087018c8991f32ac94520391f03040005029f2f0600040009033a1c000000000000052601121314000102060708091516170a1218190002030b0c0d0e15161a0f1b1c151d00030110111116b5324faf00000000040e040e0109000003678b3cc58a1424a278bf5e7cabd94265eb2ac8a9a994af748d2a1bb966572db9051d1e1f2024061a1b1c0122236e7bf20421e3387f057c429f0c9aaaf5f7c28e2894ded01a6455e389ebce5644051d1c1e1f23031a1b22b2bd0633808c88dbebe2cccdf14991ec26e768c1a48ae8547f7403f58ae8287f02e8e903e4e5e7
    ...
gagliardetto commented 2 years ago

I think the issue is that the blocks contain the new "versioned transactions", which v1.6.0 cannot handle.

If you upgrade to v1.7.1, it should work.