1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
crate::ix!();

pub fn get_oldest_key_time_in_pool(
        set_key_pool: &HashSet<i64>,
        batch:        &mut WalletBatch) -> i64 {
    
    todo!();
        /*
            if (setKeyPool.empty()) {
            return GetTime();
        }

        CKeyPool keypool;
        int64_t nIndex = *(setKeyPool.begin());
        if (!batch.ReadPool(nIndex, keypool)) {
            throw std::runtime_error(std::string(__func__) + ": read oldest key in keypool failed");
        }
        assert(keypool.vchPubKey.IsValid());
        return keypool.nTime;
        */
}

pub fn extract_pub_key(
        dest:        &Script,
        pub_key_out: &mut PubKey) -> bool {
    
    todo!();
        /*
            std::vector<std::vector<unsigned char>> solutions;
        return Solver(dest, solutions) == TxoutType::PUBKEY &&
            (pubKeyOut = CPubKey(solutions[0])).IsFullyValid();
        */
}

pub fn get_affected_keys(
        spk:      &Script,
        provider: &SigningProvider) -> Vec<KeyID> {
    
    todo!();
        /*
            std::vector<CScript> dummy;
        FlatSigningProvider out;
        InferDescriptor(spk, provider)->Expand(0, DUMMY_SIGNING_PROVIDER, dummy, out);
        std::vector<CKeyID> ret;
        for (const auto& entry : out.pubkeys) {
            ret.push_back(entry.first);
        }
        return ret;
        */
}

/**
  | OutputTypes supported by the LegacyScriptPubKeyMan
  |
  */
lazy_static!{
    /*
    static const std::unordered_set<OutputType> LEGACY_OUTPUT_TYPES {
        OutputType::LEGACY,
        OutputType::P2SH_SEGWIT,
        OutputType::BECH32,
    };
    */
}

pub fn have_keys(
        pubkeys:  &Vec<ValType>,
        keystore: &LegacyScriptPubKeyMan) -> bool {
    
    todo!();
        /*
            for (const valtype& pubkey : pubkeys) {
            CKeyID keyID = CPubKey(pubkey).GetID();
            if (!keystore.HaveKey(keyID)) return false;
        }
        return true;
        */
}