Remove references to litecoin + several tidy-ups

This commit is contained in:
Patrick Robertson
2025-03-13 17:40:00 +00:00
parent 15222199d9
commit b908655cc8
3 changed files with 12 additions and 16 deletions

View File

@@ -35,7 +35,7 @@ https://opentimestamps.org/#calendars",
the '.ots' extension.
### Features
- Creates cryptographic timestamp proofs that link files to the Bitcoin or Litecoin blockchain
- Creates cryptographic timestamp proofs that link files to the Bitcoin
- Verifies timestamp proofs have been submitted to the blockchain (note: does not confirm they have been *added*)
- Can use multiple calendar servers to ensure reliability and redundancy
- Stores timestamp proofs alongside original files for future verification
@@ -48,7 +48,7 @@ https://opentimestamps.org/#calendars",
There are two possible statuses for a timestamp:
- `Pending`: The timestamp has been submitted to the calendar server but has not yet been confirmed in the Bitcoin blockchain.
- `Confirmed`: The timestamp has been confirmed in the Bitcoin or Litecoin blockchain.
- `Confirmed`: The timestamp has been confirmed in the Bitcoin blockchain.
### Upgrading Timestamps
To upgrade a timestamp from 'pending' to 'confirmed', you can use the `ots upgrade` command from the opentimestamps-client package

View File

@@ -1,16 +1,15 @@
import os
import datetime
from loguru import logger
import opentimestamps
from opentimestamps.calendar import RemoteCalendar, DEFAULT_CALENDAR_WHITELIST
from opentimestamps.core.timestamp import Timestamp, DetachedTimestampFile
from opentimestamps.core.notary import PendingAttestation, BitcoinBlockHeaderAttestation, LitecoinBlockHeaderAttestation
from opentimestamps.core.notary import PendingAttestation, BitcoinBlockHeaderAttestation
from opentimestamps.core.op import OpSHA256
from opentimestamps.core import serialize
from auto_archiver.core import Enricher
from auto_archiver.core import Metadata, Media
from auto_archiver.utils.misc import calculate_file_hash
from auto_archiver.utils.misc import get_current_timestamp
class OpentimestampsEnricher(Enricher):
@@ -34,8 +33,8 @@ class OpentimestampsEnricher(Enricher):
continue
# Create timestamp for the file - hash is SHA256
# Note: ONLY SHA256 is used/supported here. Opentimestamps supports other hashes, but not SHA3-512
# see opentimestamps.core.op
# Note: hash is hard-coded to SHA256 and does not use hash_enricher to set it.
# SHA256 is the recommended hash, ref: https://github.com/bellingcat/auto-archiver/pull/247#discussion_r1992433181
logger.debug(f"Creating timestamp for {file_path}")
file_hash = None
with open(file_path, 'rb') as f:
@@ -150,13 +149,10 @@ class OpentimestampsEnricher(Enricher):
info["uri"] = attestation.uri
elif isinstance(attestation, BitcoinBlockHeaderAttestation):
info["status"] = "confirmed - bitcoin"
info["block_height"] = attestation.height
elif isinstance(attestation, LitecoinBlockHeaderAttestation):
info["status"] = "confirmed - litecoin"
info["status"] = "confirmed"
info["block_height"] = attestation.height
info["last_check"] = datetime.datetime.now().isoformat()[:-7]
info["last_check"] = get_current_timestamp()
attestation_info.append(info)
@@ -169,6 +165,6 @@ class OpentimestampsEnricher(Enricher):
result["verified"] = False
else:
result["verified"] = False
result["last_updated"] = datetime.datetime.now().isoformat()[:-7]
result["last_updated"] = get_current_timestamp()
return result

View File

@@ -111,10 +111,10 @@ def test_verify_timestamp(setup_module, detached_timestamp_file):
# Check attestation types
assertion_types = [a["status"] for a in verification_info["attestations"]]
assert "pending" in assertion_types
assert "confirmed - bitcoin" in assertion_types
assert "confirmed" in assertion_types
# Check Bitcoin attestation details
bitcoin_attestation = next(a for a in verification_info["attestations"] if a["status"] == "confirmed - bitcoin")
bitcoin_attestation = next(a for a in verification_info["attestations"] if a["status"] == "confirmed")
assert bitcoin_attestation["block_height"] == 783000
def test_verify_pending_only(setup_module, pending_timestamp_file):
@@ -147,7 +147,7 @@ def test_verify_bitcoin_completed(setup_module, verified_timestamp_file):
# Check that the attestation is a Bitcoin attestation
attestation = verification_info["attestations"][0]
assert attestation["status"] == "confirmed - bitcoin"
assert attestation["status"] == "confirmed"
assert attestation["block_height"] == 783000
def test_full_enriching(setup_module, sample_file_path, sample_media, mocker):