derohe-miniblock-mod/proof/proof_test.go

40 lines
27 KiB
Go
Raw Normal View History

// Copyright 2017-2018 DERO Project. All rights reserved.
// Use of this source code in any form is governed by RESEARCH license.
// license can be found in the LICENSE file.
// GPG: 0F39 E425 8C65 3947 702A 8234 08B2 0360 A03A 9DE8
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package proof
import "testing"
// this function will prove detect and decode output amount for the tx
func Test_Prove(t *testing.T) {
var address = "dERoiVavtPjhWkdEPp17RJLXVoHkr2ucMdEbgGgpskhLb33732LBifWMCZhPga3EcjXoYqfM9jRv3W3bnWUSpdmK5Jur1PhN6P"
var tx_secret_key = "da7bfcb22cfbffe7b3991411e5b5f58be141cfa61e55afc5a0ff16f378a79d05"
var tx_hex = "020001020005b209f641b156e82ba5c201f44cdb001f42b06a93079c44d3373d00c6d2690b61db93da34312a85619fa74b020002541e74edba84c61e61c90ac997e0c11498d370d81b1fb17a2baeecdfec3bd4480002ac152484a374b481375fb851099e52600a1dc993b5d5c66f9ecf7757bfc58b3f210134108680a8bce36339a0cdba2841ef49bc7144a7bc2e4a41a1c6ab60d293152c02e8f3d5e83fdc4001309e8e5dc5041b271497034b2091979cfddc681b4fd12c626701b866280fdcd7129ebecbedf97181868064e885956541def514db3986b76ee6d22dac0c84b913bbcad93701526d2f10e216bbc2830fc134a98e0d1566d432bc2f14810fda523cbb78d6c14cb55767523834d3a0ceee6fe598eda0d5b4df670d092d4e0cf29385a349ac1fa2632fd296b318437f10e44026ec56cb0945e2d59fb98ba9061b3f8acf8216cbad2640a51eff4397054480d66618653c62605e4b2bfd079a75745f8f4613e13e61abe54e5c0ced221c1df5d004907d27e2650cc2ec3be3189c526bb539db50d36ac77aa77d46682ec21b0163b0611d2d3f3d3303415eda5a010f11b4b9352c269ed7a73ee06ec701c775d1b1105f0c6e29066e69180aa8f007be84cad900e4f799066923d2d716fe66818932d4682265f0ff6965fa9fdbbd0712392cbf2fb919d7e6db96248c7ec763b6c0a8caaaae6053bcb198c28b391a0cfb099bc5d1a4cdcd0a4ebfad3035fed5fc8bcacf46670e46838831bdd803a801d30b7131bbdd2e21174ef6f991c53a5eb17ad6b993a5e22f727b00a91c07e20790d75468d06b08e1be1a169ed2dc28f33ba673890bed152dc451bfa75f8565026e56fd13088b091b6fa117a2a8fc3007fa94408725ff6fdc31b66277f202f00409410ec8b6aebbcd83504f757bccaa095c943b84bb136a548040bd520cf46c0cb2c89e2429dda03d309532e9c7d03d4af5431f08b44687918b4505304b14bb0a9d81522d824e4bec8bd8519d036336b34211774b3baed171af7dc2961ba0880b1b8cf607037617ae013ce9d65d19a7047353f3a912f5e04c006db950aa80900444758892a0c4c17b24914caffd63862cd7ac28daf51f286ebf764063f758e10238ddb2f41e891d4f559ceec11fba76422d54b4d68373220237d1586ddd90be0877689c657a7a49a146b29e27bafcad5d06a20f3374c5b65f9af29fc73b0dc20617d30b00f800ab3abc8df6f15cd0cc463149efabbfb8385dbfe88866a626160cd65d2b3de2c338aba310e995d313605d59284302cdf96957fe6e8017ce19030d672ccdda98dd45783e2dd1383d3b058f4e05c9d51e1259b02bea1da97e9b380251e90ed35a77277123d6f7fe844488808dc52b7a221a788f498af0fe8205770ab4c36421a11d3b8da62d5386a68444372cb53f52f14de3241eaee430ba139f0964d625a9c7bf89d074b0e683a14f97ee1766a963b613beae02535baf1a75fb069ad227a5f9d8d41cc6cf84c32e56455e67bccafd7491e0177e408b025fd64302aea02ec49eaab1cfe70dc64b05eadc0a370097ef5287f1fc3da6ae6c71f4c80274bda14a10db9d458f0163d09b09f3d9014ee5b253f47a9d49fefd03ce6d4208cfb08c508364d0afdff44a8f18e079d8fe4c24536565755caaa454dfa98e610ad2ff1c3f4c31f401e7f245fb04142974d0f3bd9bc7687018b6deb89554985903e7f011aa35da5847f69bfe75ad5b5e5538fba70211d4ca98c65f1d1d126be008253fb799f4e480c2e77fdec5ee0f7b5d77375dc2e7dbe9946a8199ccb4be0b011881c5b274dbe9cc0cadc15856753d9b30145c525d2063bfe29a9a29b30a3b0bfb1eb3ed4a9790a338a0ba547ab2fe05de549900a29a35b069265d62e467fc0343bb9e3e79cba52e88d39c6be3e8adf79beb4591bf519f2260bbe3da1bcbda04cf1448cb6db9b420b52aa2208439781df25355f155b91670ff28ac9895c6cf0b36e2ccf226d207411f5555941f60fe943977c09985a60390a3d9a57620732103bc057a93311cebb139f9bbb5f5e483990498183d8178918373c8d8a8be00c005e488739699d72113134e2ba6222b7592107f1d1befc346b06c1eaf8c227cc10d11a8dd4ecbf26fab04145886d06b79b697fb150aa7f65538049d46b4a3eb24097dbe8b8782f66954c2c40ce24fd248f6feb6167ae82d6fc4d71e239929fe070b914d400a1ef2e3157068f730da5cfd49fca5542483a399daf2ec23f3b9a7630753b6b3d477b178a2f70c40b7647b6844508dcebf8c9600ca883d4ae4baf75c03fd72c4c1a2acc9a8a171be79556cd6e1c4ec50eba3c7530807592466363124018b28d6d0c222cd5d5a74fb9d7b7f0b888b5f717b29e5908baaad234e116d330ac62f0a3ddaa2b5ccc3dd1a7930c69a986d94e4b29b808af0dd38490477ece70d3b1c1a0199a67a450c34ab4fa2914a65c7da9fb2980c2b9491ad01d50cdb790c027d293eac66898623f86728c0d4ca43d6de9b94fcb3d3c4393e699c0ba808049f264b8466c94be6a3359a799f701b690731c27b18647af205e36f5c24b79403753ccb7abc1a1da6c7f392e6aa971205197c5868f096f7c6d4bf30c9f046fb0504b8017826fda4c59ef3e2abb5fe86084f252b1b0cff643394dfb8e6339d9809e708c56a778b7f0b0043a308d9063fa0dc8887e1ad3aab919375280143740e03127117d58d53d6da0acf1f93f7690994d1c743917e18c618d955bc9462534a0b488d121ffcd91182522a1d3b01437155b78b8bfe061ff675d1d344fe820c0109429445f2027cd7db2d77797dc683e3945f399ef8ef5d70adb6f6a9227f80150ebf23c2029fdf560767805d6043023e59e255967f1cd477fff9b9
indexes, amounts, _, err := Prove(tx_secret_key, address, tx_hex)
if err != nil {
t.Fatalf("Proving transaction failed err %s", err)
}
if len(indexes) != len(amounts) && len(amounts) != 2 {
t.Fatalf("Proving transaction failed expected 2,2 actual %d,%d", len(indexes), len(amounts))
}
}