git.gammaspectra.live/P2Pool/consensus/v3@v3.8.0/monero/client/client_test.go (about)

     1  package client
     2  
     3  import (
     4  	"context"
     5  	"git.gammaspectra.live/P2Pool/consensus/v3/types"
     6  	"os"
     7  	"testing"
     8  )
     9  
    10  func init() {
    11  	SetDefaultClientSettings(os.Getenv("MONEROD_RPC_URL"))
    12  }
    13  
    14  var txHash, _ = types.HashFromString("d9922a1d03160a16e4704b44dc0ed0e5dffc46db94ca86d6f10545132a0926a0")
    15  var txHashCoinbase, _ = types.HashFromString("dc18b8ad30e15b21c733032288ac0afa08ae51c972b4ee6546ad74aa77c39ebb")
    16  
    17  func TestOutputIndexes(t *testing.T) {
    18  	if result, err := GetDefaultClient().GetOutputIndexes(txHashCoinbase); err != nil {
    19  		t.Fatal(err)
    20  	} else {
    21  		t.Log(result)
    22  	}
    23  }
    24  
    25  func TestInputs(t *testing.T) {
    26  	if result, err := GetDefaultClient().GetTransactionInputs(context.Background(), txHash); err != nil {
    27  		t.Fatal(err)
    28  	} else {
    29  		t.Log(result)
    30  
    31  		inputs := make([]uint64, 0, len(result)*16*128)
    32  		for _, i := range result[0].Inputs {
    33  			inputs = append(inputs, i.KeyOffsets...)
    34  		}
    35  
    36  		if result2, err := GetDefaultClient().GetOuts(inputs...); err != nil {
    37  			t.Fatal(err)
    38  		} else {
    39  			t.Log(result2)
    40  		}
    41  	}
    42  }